Elevate - "executes a command with UAC privilege elevation. This is useful for working inside command prompts or with batch files." It's not the same as
sudo, it changes the executing user to Administrator, but its syntax is a lot more straightforward to use than
runas, and it can keep the current directory, enabling the use of relative paths.
elevate [(-c | -k) [-n] [-u]] [-w] command
-c Launches a terminating command processor; equivalent to "cmd /c command".
-k Launches a persistent command processor; equivalent to "cmd /k command".
-n When using -c or -k, do not pushd the current directory before execution.
-u When using -c or -k, use Unicode; equivalent to "cmd /u".
-w Waits for termination; equivalent to "start /wait command".
Elevate's purpose isn't to work around or bypass UAC (User Account Control), but to work with it. As long as UAC is enabled there has to be some kind of prompt at some point in the process. If you need to get rid of prompting altogether you have to disable UAC.
The pain point Elevate alleviates is escalating a particular process from a non-privileged shell and then carrying on as normal. Without this you need to start a privileged command prompt with right-click > "Run as Administrator" before attempting the privileged command, which can't be easily scripted.
This works well with "Elevate without prompting" in
secpol.msc. Together, they do the same as
%wheel ALL=(ALL) NOPASSWD: ALL in sudo
A known limitation is that it does not return the error code from the program it is elevating.
If your muscle memory is stuck on sudo, create an alias using Doskey:
doskey sudo=elevate -w
or batchfile in PATH:
@elevate -w %*
Elevate is 3rd party tool written by Johannes Passing. It's an 11kb download and portable (no install needed): http://code.kliu.org/misc/elevate/