Reputation: 99
in python, i want to executes cmd command:
os.system("netsh interface set interface \"Local Area Connection\" disable")
to disconnect internet network. But, with my account, it report, interface name not register router. I think that, i need to executes os.system as admin. But i don't know how to use it as admin! So, can you help me! Thank.
Upvotes: 6
Views: 19254
Reputation:
To run command as admin on Windows, ou can use Windows runas command (I don't have access to a Windows machine right now, but perhaps..);
import subprocess
subprocess.call(['runas', '/user:Administrator', 'Your command'])
Upvotes: 2