如何在windows上以更高的权限运行python脚本
import osimport sysimport 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(lpVerb='runas', lpFile=sys.executable, lpParameters=params) sys.exit(0)print "I am root now."
相关分类