How can I get the UAC prompt to give my Python code Admin rights? I have tried this but Python 32 Bit or my Terminal just freezes:
import os
import sys
import win32com.shell.shell as shell
ASADMIN = 'asadmin'
if sys.argv[-1] != ASADMIN:
script = os.path.abspath(sys.argv[0])
params = ' '.join([script] + sys.argv[1:] + [ASADMIN])
shell.ShellExecuteEx(lbVerb='runas', lpFile=sys.executable, lpParameters=params)
sys.exit(0)
with open("somefile.txt", "w") as out:
print >> out, "i am root"