As an IT tech I often have to open my command prompt as my domain administrator user which has administrator access on remote computers. I always forgets to right-click cmd and choose “Run as …” so I figured out a little shortcut for those times to mimic the su
function in Linux.
Please note this won’t turn your currently open command prompt into an elevated one, it will just run a new cmd.exe process as the user you need.
Open an elevated command prompt and change directory to %windir%\system32
and run this command:
echo runas /user:domain\username "cmd" > sudo.bat
Now you can type “sudo” wherever (in your Run window or an existing cmd prompt) and it will prompt you for the password and open a new cmd window with the pre-defined user.
Was this post helpful?
Let us know if you liked the post. That’s the only way we can improve.