How to run python code as administrator ? | Sololearn: Learn to code for FREE!

+6

How to run python code as administrator ?

Python manually need to run as administrator how can i achieve this plse help ?

7 Answers

New Answer

+5

K.Boopathi Where do you want to run your program? and on which platform? I mean from command prompt or in IDE? On Windows from command prompt, use runas command syntax : runas / user:administrator e.g runas /user:administrator notepad or launch the command prompt as administrator itself. then any program launched from the shell will runas administrator. From IDE: run the IDE as administrator itself then run the code from IDE. On linux/unix from terminal run python code as "su" or "sudo"

+5

~ swim ~ i need to overwrite a file that need administrator permission

+5

rajesh kumar when run your code it show no module win32com.shell What i need to do

+4

~ swim ~ i need that Python automatically run as administrator

+2

K.Boopathi In your question you have written "python manually needs to run as administrator" ! Anyways can you be more specific what you are trying to do? Are you , through your code trying to access some resource on your machine that requires admin level access and wants that happens automatically?

+2

K.Boopathi Some solutions here https://stackoverflow.com/q/19672352/7986108

0

K.Boopathi Ok. I now assume rajesh kumar answer provides you a solution you were looking for.