Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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)
Comment

python command as an administrator

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)
Comment

PREVIOUS NEXT
Code Example
Python :: python read file in string list 
Python :: waitkey in opencv 
Python :: python print list items vertically 
Python :: epoch to datetime utc python 
Python :: Select rows from a DataFrame based on column values? 
Python :: how to reset a variable in python 
Python :: # find the common elements in the list. 
Python :: python distance of coordinates 
Python :: emacs region indent python 
Python :: how to add card in py-trello 
Python :: shuffle array python 
Python :: python overwrite text that is already printed 
Python :: how to add headers in csv file using python 
Python :: how to add space before capital letter in python 
Python :: how to color print in python 
Python :: python n choose r 
Python :: list of characters python 
Python :: save plot as image python matplotlib 
Python :: django update increment 
Python :: python histogram as a dictionary 
Python :: python swap 0 into 1 and vice versa 
Python :: removing a channel from aconda 
Python :: how to print something with tkinter 
Python :: how to print dataframe in python without index 
Python :: pandas sort values group by 
Python :: boston dataset sklearn 
Python :: from sklearn.metrics import classification_report 
Python :: how to convert string to function name in python 
Python :: spacy matcher syntax 
Python :: pyqt5 display math 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =