Jump to content
MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. ×

SuDo equivalent for Windows Vista/7


Recommended Posts

Have you ever wanted to run a program from command line with admin rights under Vista/7?

The solution is a sudo clone.

Start notepad.exe and copy the following text into a new text file and save it as sudo.cmd:

@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 %temp%\sudo.tmp.vbs

Now copy the file to your Windows folder.

Now you can

sudo cmd.exe

to easily start a command prompt with admin rights.

Link to comment
Share on other sites

Neat script, but what about this. According to Wikipedia, using the RunAs command is similar to running the "SU" command from linux, not SUDO.

Runas, su and sudo

Windows has a command runas which has similar functionality, but neither runas nor UAC are sudo, they impersonate another user rather than privilege escalation.

Runas and su:

* do not allow authorized users to launch processes with elevated privileges using their own passphrase.

* do not preserve the user's profile and ownership of created objects.

The runas command is (more or less) equivalent to Unix su, not sudo. The reason sudo is superior to su is that it allows privilege escalation based on the user’s own identity, and most importantly does not require use of a shared password. Using runas or su to access a privileged account requires distribution of a password to an admin-capable account, a security weakness that sudo does not have.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...