The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    Running Batch File as an Administrator in Vista

    Discussion in 'Windows OS and Software' started by hendra, Feb 18, 2009.

  1. hendra

    hendra Notebook Virtuoso

    Reputations:
    157
    Messages:
    2,020
    Likes Received:
    6
    Trophy Points:
    56
    How do I run a batch file as an administrator in Vista without having to right click and choose "run as an administrator" every single time? I can't change the privilege level because it is disabled (greyed out).
     
  2. ScuderiaConchiglia

    ScuderiaConchiglia NBR Vaio Team Curmudgeon

    Reputations:
    2,674
    Messages:
    6,039
    Likes Received:
    0
    Trophy Points:
    205
    Simply put, I don't think you can.

    Gary
     
  3. davepermen

    davepermen Notebook Nobel Laureate

    Reputations:
    2,972
    Messages:
    7,788
    Likes Received:
    0
    Trophy Points:
    205
    create a shortcut to it and set there "run as admin". but the uac prompt will logically still return
     
  4. qhn

    qhn Notebook User

    Reputations:
    1,654
    Messages:
    5,955
    Likes Received:
    1
    Trophy Points:
    205
    would this apply?

    http://www.vistaclues.com/run-a-batch-file-as-an-administrator/

    cheers ...
     
  5. swarmer

    swarmer beep beep

    Reputations:
    2,071
    Messages:
    5,234
    Likes Received:
    0
    Trophy Points:
    205
    Yeah, create a shortcut and in the shortcut properties set it to run as administrator. Once a shortcut's created, you can right-click it > Properties > Shortcut tab > Advanced > Run as administrator.
     
  6. ScuderiaConchiglia

    ScuderiaConchiglia NBR Vaio Team Curmudgeon

    Reputations:
    2,674
    Messages:
    6,039
    Likes Received:
    0
    Trophy Points:
    205
  7. swarmer

    swarmer beep beep

    Reputations:
    2,071
    Messages:
    5,234
    Likes Received:
    0
    Trophy Points:
    205
    That link is working for me.
     
  8. Pirx

    Pirx Notebook Virtuoso

    Reputations:
    3,001
    Messages:
    3,005
    Likes Received:
    416
    Trophy Points:
    151
    Another option: Use the "runas" command. Type "runas /?" at a command prompt for more info.
     
  9. hendra

    hendra Notebook Virtuoso

    Reputations:
    157
    Messages:
    2,020
    Likes Received:
    6
    Trophy Points:
    56
  10. qhn

    qhn Notebook User

    Reputations:
    1,654
    Messages:
    5,955
    Likes Received:
    1
    Trophy Points:
    205
    It works Gary, try again, I just checked it. Swarmer confirmed also from above.

    cheers ...
     
  11. qhn

    qhn Notebook User

    Reputations:
    1,654
    Messages:
    5,955
    Likes Received:
    1
    Trophy Points:
    205
    I believe that it is correct, this is different as "elevation" prompt, and the batch is running under administration mode. Try disabling UAC and test it out. I will look into it a bit more later when I get home.

    cheers ...
     
  12. ScuderiaConchiglia

    ScuderiaConchiglia NBR Vaio Team Curmudgeon

    Reputations:
    2,674
    Messages:
    6,039
    Likes Received:
    0
    Trophy Points:
    205
    Yep, the link was fine last night when I checked it again. Twas a temporary glitch.

    Gary
     
  13. swarmer

    swarmer beep beep

    Reputations:
    2,071
    Messages:
    5,234
    Likes Received:
    0
    Trophy Points:
    205
    Of course you do. UAC requires permission if you need to run something with elevated privileges. This isn't new; you were getting that prompt before too, after you right-clicked the batch file and did "Run as administrator". We just got rid of that part. So your batch file is now treated just like any other program requiring admin privileges.

    If you don't want these prompts, you can turn off UAC. I don't recommend that though, since it means that all your programs will run with full permissions to modify the OS, change the system configuration, install things in the kernel, etc. But if you want to keep UAC on for most stuff, but you want to make an exception for particular shortcuts such as this one, follow these instructions to make the auto-elevating shortcuts: http://blogs.zdnet.com/Bott/?p=436&page=4