Answers for "open administrator command prompt using python"

1

open administrator command prompt using python

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(lpVerb='runas', lpFile=sys.executable, lpParameters=params)
    sys.exit(0)
Posted by: Guest on March-30-2021

Code answers related to "open administrator command prompt using python"

Python Answers by Framework

Browse Popular Code Answers by Language