Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
is there any 'Sudo' command for windows ?

I was wondering how to switch to having administrative privileges in a command line window of Windows? Is there any way similar to "su" or "sudo" under Linux?

For example, I was stuck here:

Q:>fsutil fsinfo drives

The FSUTIL utility requires that you have administrative privileges.

Thanks and regards!


  1. I am not sure what is wrong:

    C:\D>runas /user:Tim "fsutil fsinfo drives"
    Enter the password for Tim:
    Attempting to start fsutil fsinfo drives as user

    "TIM-THINK\Tim" ...

    C:\D>runas /user:Tim "dir"
    Enter the password for Tim:
    Attempting to start dir as user "TIM-THINK\Tim" ...
    RUNAS ERROR: Unable to run - dir
    2: The system cannot find the file specified.

    if without the quote for the command in the end, the first example will output the help document for runas, and the second example will output the same as with quote.

  2. I was also wondering if I can switch to having administrative privileges once for all in the current session of the command line window, just as "su" in Linux?
share|improve this question

marked as duplicate by nhinkle, studiohack Feb 6 '11 at 20:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 3 down vote accepted

You can try the RUNAS command.

Q:>runas /user:Tim "fsutil fsinfo drives"

From the help:

C:\> runas /?

RUNAS [ [/noprofile | /profile] [/env] [/savecred | /netonly] ]
        /user:<UserName> program

RUNAS [ [/noprofile | /profile] [/env] [/savecred] ]
        /smartcard [/user:<UserName>] program

RUNAS /trustlevel:<TrustLevel> program

   /noprofile        specifies that the user's profile should not be loaded.
                     This causes the application to load more quickly, but
                     can cause some applications to malfunction.
   /profile          specifies that the user's profile should be loaded.
                     This is the default.
   /env              to use current environment instead of user's.
   /netonly          use if the credentials specified are for remote
                     access only.
   /savecred         to use credentials previously saved by the user.
                     This option is not available on Windows Vista Home or Windo
ws Vista Starter Editions
                     and will be ignored.
   /smartcard        use if the credentials are to be supplied from a
   /user             <UserName> should be in form USER@DOMAIN or DOMAIN\USER
   /showtrustlevels  displays the trust levels that can be used as arguments
                     to /trustlevel.
   /trustlevel       <Level> should be one of levels enumerated
                     in /showtrustlevels.
   program         command line for EXE.  See below for examples

> runas /noprofile /user:mymachine\administrator cmd
> runas /profile /env /user:mydomain\admin "mmc %windir%\system32\dsa.msc"
> runas /env / "notepad \"my file.txt\""

NOTE:  Enter user's password only when prompted.
NOTE:  /profile is not compatible with /netonly.
NOTE:  /savecred is not compatible with /smartcard.

dir is a builtin command. You would need to do:

runas /user:Tim "cmd /c dir"

To run a CMD shell as another user:

runas /user:Tim "cmd"
share|improve this answer
Thanks! But I still cannot make it right. Please see my update. – Tim Feb 6 '11 at 16:17
@Tim: See my edited answer. – Dennis Williamson Feb 6 '11 at 16:33
(1) For either "runas /user:Tim "fsutil fsinfo drives"" or "runas /user:Tim "cmd /c dir"", the output is in a new window which exists as soon as finishing output. How to keep the output stay before I close the window or just output in the same command window? (2) "runas /user:Tim "cmd"" creates a new command line window, where I still have to run "runas /user:Tim ..." to gain administrative privileges. Is that supposed to be once for all just like "su"? (3) I logined as Tim which is adminstrator, but why I still need to run "runas /user:Tim ..." to gain administrative privileges? – Tim Feb 6 '11 at 16:54
Try /k instead of /c. For (3) that's part of the way security on Windows works. Another thing to try is start /b. See help cmd and help start. – Dennis Williamson Feb 6 '11 at 18:19

Search command prompt in the Start Menu and right click on the entry->Run as administrator.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.