By registering with us, you'll be able to discuss, share and exchange private messages with other members of our community.

SignUp Now!


Yesterday someone asked me if I knew a Windows built-in way to have some sort of SUDO to elevate from the CMD prompt, so you could do things like sudo regedit, sudo xxx.cpl, sudo xxx.mmc or even sudo del abc.txt.
I didn't and as it was a slow day, we decided to team up: he would google for it and I would try to come up with something. Google didn't give us anything (other than external utilities and a lot of people asking the same question), but I did find a way.
It was still a little rough around the edges (to my taste), but he was happy.

I'm considering posting it here, but as it requires more work on it, translation to English and it is quite off-topic here (in TCC you could just do something like alias sudo=start /elevated /pgm; Powershell is trivial too). Beside all that: the general interest in the other scripts I penned down here are downloaded in single digits numbers, so there might be no interest at all in this one.

Before going through all the effort: is there any interest in a SUDO for CMD?
Last edited:
I haven't tried this, but it looks like it might work:
@echo Set objShell = CreateObject("Shell.Application") > %temp%\sudo.tmp.vbs
@echo args = Right("%*", (Len("%*") - Len("%1"))) >> %temp%\sudo.tmp.vbs
@echo objShell.ShellExecute "%1", args, "", "runas" >> %temp%\sudo.tmp.vbs
@cscript //NoLogo %temp%\sudo.tmp.vbs
You'd use it like: sudo command args

And I guess this registry hack turns off UAC prompts:
Windows Registry Editor Version 5.00
Nice one! Never knew you could use the RunAs verb with ShellExecute. You learn something new every day.... Thanks!
I did test it and it works great for the regular stuff: start cpl's /mmc's or start an elevated cmd /regedit (which is probably enough for most cases).

Just FYI: the elevated command starts in System32 (although I tried to convice ShellExecute to use a different working directory by passing that as an argument) and it is allergic to double quotes. You can't do something like: sudo "notepad".
Still: very nice!

( FWIW: the CMD equivalent of %@UNQUOTES[%1] is %~1 )
I've been using a program called 'elevate'. It elevates the named program, both under cmd and tcc.
Download at [title]

Another program i found is ELE, from winreview.ru This launches COMSPEC at the command directory, in a separate window.
[title] and select the download (Ckayati) link.