Create a su command for Windows Command Prompt

Posted on 16.05.17   CLI sudo SysAdmin Windows

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.

More on ITDB

Change Resize Mode for all VMs in RoyalTS 4


Get Linux distribution information from terminal


Oracle Universal Installer - Successfully completed with errors


NiceHash hacked?


Finding the source for locked AD account from Event Viewer log on Domain controller




Leave a Reply

Your email address will not be published. Required fields are marked *