Answers for "how to run a python script from terminal with all permissions win 10"

4

how to run python script as admin

import ctypes, sys
def is_admin():
    try:
        return ctypes.windll.shell32.IsUserAnAdmin()
    except:
        return False
if is_admin():
    # Code of your program here
else:
    # Re-run the program with admin rights
    ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1)
Posted by: Guest on November-12-2020
12

run python file using python code

exec(open('file.py').read())
Posted by: Guest on May-24-2020

Code answers related to "how to run a python script from terminal with all permissions win 10"

Python Answers by Framework

Browse Popular Code Answers by Language