su for Windows XP

Ever wanted to perform an action as the administrator (super-user) in Windows / Windows XP but you didn’t want to go to the bother of switching users?

I’ve worked out a shortcut that does just that.

%windir%\System32\runas.exe /user:myMachine\adminUser "C:\Program Files\Internet Explorer\IEXPLORE.EXE c:"

Replace myMachine with your computer’s name. Put the name of the administrator account in for adminUser.

Here’s how it looks on my computer:

%windir%\System32\runas.exe /user:orion\root "C:\Program Files\Internet Explorer\IEXPLORE.EXE c:"

When you run this shortcut, you’ll be prompted to enter the password for your admin account.

It works very well for most tasks. You may notice that you have to manually refresh Explorer windows running as admin using this shortcut. For instance, if you rename a file or add a folder the change won’t appear automatically, but if you press F5, it shows up.

This works for Windows 2000 and for Windows XP. I it does not work well under Windows Vista, but then you don’t need it for Vista as the OS makes it easy to elevate your privileges when needed.

Published in: on February 27, 2008 at 12:34 am  Comments (7)  
Tags: , ,

The URI to TrackBack this entry is:

RSS feed for comments on this post.

7 CommentsLeave a comment

  1. This is not really su. If su runned from root, su don’t need password for any user. runas need enter password interactively for any user.

  2. actually runas kinda reminds me of gksu.

  3. Hello, David.

    Thank you for the tip.

    I provide free support to all of the Windows XP systems run by each member of my family in my area (eight computers).

    One user refuses to assign a password to either of the two user accounts and uses the login screen instead of the CTRL+ALT+DEL “classic” login screen. Both accounts run with full administrative privileges. (The computer contains financial information and one of the users died of cancer in 2006.)

    The other users insist that a standard user account is “too inconvenient” and their accounts are administrative accounts.

    I always have one of these computers at my house, because Widnwos XP has been rendered nonfunctional by malicious software that slipped past security software (AVG free for my “repeat customer”). I can rarely recover data, but I can often identify the “payload” of the malicious software; in every case, the “masware” needed to be on an administrative account. On a regular user account, it would have remained inert.

    For years, I have been warning of the security risks associated with running with administrative privileges, but I have been ignored. I have persuaded the users of AVG Free that free security software is a risk, but our broadband ISP provides McAfee’s security suite free to subscribers, which brings the two 512-MB PCs to their needs. (Fortunately, 512-MB of additional RAM for these 2004 Pentium 4s is $20 USD.)

    I would think that my security warnings would be heeded by users who have repeatedly lost most of their data, and the use of their computers for at least two days (because of recovery time), so I will try ‘su’ for Windows XP on the PC I currently am restoring. I suspect that I will receive protests and complaints, however.

    I automatically assumed, www2, that David is referring to the “root” directory, not the ‘root’ account.

    For example, the main root directory on the system drive/partition is ‘C:’ and the root for the programs directory is typically ‘C:\Program Files’.



    • You make a good point, but I think it’s nearly impossibly to convince people why running as “admin” all the time is a bad idea. But it might make running as a normal user a little more palatable for the hold-outs.

      I cleaned up the text a little to hopefully remove some of the confusion. Again, this trick is only useful for pre-Vista versions. If you have Vista, you already have this ability built-in.

  4. if you use this


    as the target for iexplorer instead of c:, it will open the folder on the admin’s desktop with control panel easily accessible on the left. Plus it is a nice place to have shortcuts than in c:

  5. Thank you very much. This was a great tip. I didn’t know about runas at all. Looked up for ‘windows su’ and your link showed up. It worked perfectly.

  6. Hi! I understand this is somewhat off-topic but I needed to ask.
    Does operating a well-established blog loke yours rewuire a large amohnt of work?
    I’m brand new to writing a blog however I doo write in my diay daily.

    I’d like to start a blog so I can easily share my experience and thoughts online.
    Please lett me know if you have any kind of ideas or tips for brand new
    aspiring bloggers. Appreciate it!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: