command line - switch to administrator mode

Is it possible to switch from normal mode to administrator mode in command line? I don't want to open command line by right clicking and selecting "run as administrator". Thanks


Solution 1:

The answer is no. The "full administrative token" is associated with an .EXE when it's launched. You need to start a new CMD.EXE to get full-admin privs. To make UAC a bit more bearable, you can enable "auto-admin approval" through group policy.

Solution 2:

Or from within Powershell:

Start-Process powershell -Verb runas

Solution 3:

How about this:

runas /user:administrator cmd.exe

Solution 4:

You can't really "switch" between the two modes, but there are some 3rd party tools that let you launch programs from the command line in the elevated admin. Provided you drop them into a working path, you could, for example, use "elevate cmd" from the start menu or from an existing command prompt to start a new session in the elevated mode.

Solution 5:

You can have a shortcut to cmd.exe and just modify the Advanced properties tab to "Run as Administrator".