Possible Duplicate:
Is there any 'sudo' command for Windows?
Commands su
& sudo
could be used to turn whole current terminal session as super user with administration privileges.
What's the corresponding command of Windows CMD ?
I know that I can start CMD as administrator by
- Right click & Start as Administrator
- Typing CMD in start search bar the
CTRL + SHIFT + ENTER
But I want to evaluate this permission from inside CMD.
Answer
The equivalent in Windows is the "runas" command, it is similar to the "sudo" command in unix/linux but you have to specify the user as well. A typical example would be:
runas /user:mymachine\administrator [command]
If your user is is an Administrator you can use your own username like so:
runas /user:myusername ipconfig
To elevate an entire command prompt just put "cmd" in as the command to run, ie:
runas /user:myusername cmd
There may be other ways of doing this, but this is the way I've done it for years and have seen done in corporate scripted environments.
No comments:
Post a Comment