Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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)

Comment

PREVIOUS NEXT
Code Example
Python :: jupyter clear cell output programmatically 
Python :: get pytorch version 
Python :: convert column string to int pandas 
Python :: Flask Gmail 
Python :: python setter getter deleter 
Python :: write to txt python 
Python :: python color in console 
Python :: iterate over df 
Python :: installing django 
Python :: numpy find rows containing nan 
Python :: python rename file 
Python :: python how to flatten a list 
Python :: python schedule timezone 
Python :: pygame get mouse position 
Python :: python get time of day 
Python :: python install pandas for linux 
Python :: add text to plot python 
Python :: send message to specific channel discord.py 
Python :: python get current time in seconds 
Python :: convert json to x-www-form-urlencoded pyhon 
Python :: ctypes run as administrator 
Python :: how to count docx pages python 
Python :: python pyodbc install 
Python :: flask run app reset on change 
Python :: make a zero list python 
Python :: isprime function in python 
Python :: pandas select rows with values in a list 
Python :: copy files python 
Python :: record video with python 
Python :: initialize pandas dataframe with column names 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =