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 inject into process 
Python :: tkinter copy paste 
Python :: ast python 
Python :: django templates 
Python :: neural network hyperparameter tuning 
Python :: how to select li element in selenium python 
Python :: arg parse array argument 
Python :: flask flash 
Python :: gzip folder python 
Python :: django queryset limit 
Python :: discord bot python time delay 
Python :: for enumerate python 
Python :: python pandas series to title case 
Python :: list of dicts 
Python :: dense layer keras 
Python :: multiline comment in python 
Python :: selenium undetected chromedriver error 
Python :: Get the square root of a number in Python 
Python :: how to convert datetime to integer in python 
Python :: create django project 
Python :: import fernet 
Python :: how to detect the reaction to a message discord.py 
Python :: record audio with processing python 
Python :: sequenza di fibonacci python 
Python :: list length in python 
Python :: visit website with python 
Python :: rename files with spaces in a folder python 
Python :: python how to get last element in a list 
Python :: python sleep 
Python :: abs function in python 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =