How to run Batch File as Admin?

Page 1 of 3 123 LastLast

  1. Posts : 505
    Windows 7 Professional x64
       #1

    How to run Batch File as Admin?


    Hello,

    I want to know how can i run a Batch File (.bat) as administrator since the Run as Administrator Checkbox in Compatibility tab is gray (can't check)?
    This is the Batch File:
    @echo off
    cd /d "C:\Program Files (x86)\Ubisoft\Far Cry 2\bin"
    start /realtime FarCry2.exe

    Should i put something like Start as admin /realtime ???

    Thanks,
    Alex.
      My Computer


  2. Posts : 990
    Windows 7 Home Premium x64
       #2

    Make a shortcut to the bat?
      My Computer


  3. Posts : 505
    Windows 7 Professional x64
    Thread Starter
       #3

    Captain Zero said:
    Make a shortcut to the bat?
    Tried that, but the Run as Admin still greyed.
      My Computer


  4. Posts : 805
    XP Pro SP3 x86/Vista SP2 x64/Win7 x64 Triple-boot
       #4

    You could try the 'runas' command from another batch initialy, but not sure if it will pass it on to farcry2 though.

    Create an initial batch with something like this inside:
    Code:
    runas /user:REQUIREDUSERNAME /savecred c:\SECONDBATCH.BAT
    with your original batch being SECONDBATCH.BAT and replacing 'REQUIREDUSERNAME' with admin account name.

    /savecred will make it ask for admin password on first run only.

    like I said, Im not sure because I havn't tried it.

    EDIT: maybe right-click farcry2.exe and set that to run as admin might help.
      My Computer


  5. Posts : 990
    Windows 7 Home Premium x64
       #5

    The other option is to simply check the 'Run as Admin' option for the FC2 shortcut. You shouldn't need it but some apps/games require this on first fun, especially under 7.
      My Computer


  6. Posts : 805
    XP Pro SP3 x86/Vista SP2 x64/Win7 x64 Triple-boot
       #6

    I think he wants to use 'start' for the realtime option, the only way of setting priority using the UI is through taskmanager and right-clicking the process, which Windows forgets once you close the app.

    Edit: Strange, Just tried the shortcut to a batch and I can set 'run as admin' here on mine.
      My Computer


  7. Posts : 445
    Vista Ult 64bit - Windows 7 Ult 7264 64bit
       #7

    AFAIK, a batch file should run under the same permissions by default, as the user account it's being run from.
      My Computer


  8. Posts : 1,261
    Windows 7 Professional 32-bit SP1
       #8

    AlexRD said:
    Hello,

    I want to know how can i run a Batch File (.bat) as administrator since the Run as Administrator Checkbox in Compatibility tab is gray (can't check)?
    This is the Batch File:
    @echo off
    cd /d "C:\Program Files (x86)\Ubisoft\Far Cry 2\bin"
    start /realtime FarCry2.exe

    Should i put something like Start as admin /realtime ???

    Thanks,
    Alex.
    All replies have been good, and should work, but there is another workaround that can be used so that Administrator Mode will not be required.

    The trick is to remember that "C:\Program Files" and "C:\Program Files (x86)" are protected folders in Vista and Windows 7. Any process that attempts to write to them requires either Administrator or Installer access rights.

    You can avoid that altogether by installing games to some other user created folder, such as "C:\Games". In other words, when you install a game, when you get to the "Selectg Destination" part of the installer, change the default path to "C:\Games\Far Cry 2".

    This will allow the game to be run from an "unprotected" folder, thus allowing normal user rights. And you will likely also not need a special batch file either.

    Good thing I've been installing games to "C:\Games" since as far back as Win 95. I've gotten into the habit long ago...
      My Computer


  9. Posts : 1,557
    XP, Seven, 2008R2
       #9

    better yet, install games to a different partition altogether. It will save you from having to reinstall most of them the next time you reformat/reinstall Windows.

    I haven't installed a game on my C: drive in ages. I personally install them on a RAID0 array, occasionally backing up my savegames to an external USB drive.
      My Computer


  10. Posts : 505
    Windows 7 Professional x64
    Thread Starter
       #10

    No, you don't get it.
    To change a process to REALTIME, its necessary to run as administrator.
    And it will prompt to UAC, but now the thing is:

    I can run manually on Uac, but then i would have to right click and run as administrator, always.
    I wanted it to be like, everytime i double-click it already run as admin without me having to right-click it.
      My Computer


 
Page 1 of 3 123 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 15:17.
Find Us