Sunday, December 27, 2015

Sudo for Windows, and optionally through launchy

Sometimes you need a fast shell with elevated privileges to perform certain administrative tasks. An easy way to do this is to right click on the command prompt link and choose the run-as-administrator option. I personally prefer having a shortname from my favorite launcher Launchy or from the working Shell, but we'll come to that later.

To follow along, we have to have chocolatey installed for this matter. The installation is a single-step. We'll install the sudo package from Chocolatey using the below command

cinst sudo -y

Whenever an elevated shell is needed you can sudo cmd ,or if it's a single command you can use sudo followed by the command.

My favorite option is having an elevated shell right inside launchy for quick access. To do this, open launchy options --> plugins tab and select the runner item
Below cmd, add another short name (ex: cdma ) with the below attributes

Now press OK , close and reopen launchy and try cmda (or whatever shortname you chose )

And this will start the command prompt as an administrator.