문제

import _winreg as wreg
key = wreg.CreateKey(wreg.HKEY_LOCAL_MACHINE, "Software\\testfolder")

I can't seem to make this code work without admin permissions. Is there something I need to add to my code to make this work? Or is the best way to go about this, prompting for admin permissions? If so, how do I get Windows to generate that prompt?

Thanks so much.

도움이 되었습니까?

해결책

key = wreg.CreateKey(wreg.HKEY_CURRENT_USER, "Software\\testfolder")

I think you can do ... if you need to write to a keyspace that requires admin(eg. LOCAL_MACHINE) you will need to elevate permissions

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top