Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: How to run Batch File as Admin?

12 Jun 2009   #1

Windows 7 Professional x64
 
 
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 System SpecsSystem Spec
.

12 Jun 2009   #2

Windows 7 Home Premium x64
 
 

Make a shortcut to the bat?
My System SpecsSystem Spec
12 Jun 2009   #3

Windows 7 Professional x64
 
 

Quote   Quote: Originally Posted by Captain Zero View Post
Make a shortcut to the bat?
Tried that, but the Run as Admin still greyed.
My System SpecsSystem Spec
.


12 Jun 2009   #4

XP Pro SP3 x86/Vista SP2 x64/Win7 x64 Triple-boot
 
 

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 System SpecsSystem Spec
12 Jun 2009   #5

Windows 7 Home Premium x64
 
 

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 System SpecsSystem Spec
12 Jun 2009   #6

XP Pro SP3 x86/Vista SP2 x64/Win7 x64 Triple-boot
 
 

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 System SpecsSystem Spec
12 Jun 2009   #7

Vista Ult 64bit - Windows 7 Ult 7264 64bit
 
 

AFAIK, a batch file should run under the same permissions by default, as the user account it's being run from.
My System SpecsSystem Spec
12 Jun 2009   #8

Windows 7 Ultimate x64
 
 

Quote   Quote: Originally Posted by AlexRD View Post
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 System SpecsSystem Spec
12 Jun 2009   #9

XP, Seven, 2008R2
 
 

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 System SpecsSystem Spec
12 Jun 2009   #10

Windows 7 Professional x64
 
 

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 System SpecsSystem Spec
Reply

 How to run Batch File as Admin?




Thread Tools




Our Sites

Site Links

About Us

Find 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 03:28 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33