How can I elevate a open cmd window such that it has administrator rights as it would have if i would start it with "run as administrator"?
Asked
Active
Viewed 8,883 times
2 Answers
3
You can use the runas command to elevate individual commands, and you can use runas to start a new shell, but you cannot elevate the current shell.
EKW
- 1,036
1
I have a hard time believing that this would be possible. Even the example by Microsoft restarts the process to achieve elevation.
Oliver Salzburg
- 87,539
- 63
- 263
- 308
runaswill open a new process. But, in some cases, elevation from Explorer can be broken without affecting elevation from a command prompt. Similar issues can show up with InstallShield. – EKW Mar 09 '12 at 13:15runas /user:administrator cmdwill still fire off UAC. This is a misconception, because the builtin Admin account has autoelevate enabled. – surfasb Mar 10 '12 at 02:46runasruns as another user. If you userunasto run something as Admin, it will call UAC in order to elevate, which is the desired outcome. UAC failing when called from Explorer doesn't automatically mean UAC will fail no matter what the calling process. – EKW Mar 10 '12 at 06:57