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
AlexRD

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
Captain Zero

Windows 7 Home Premium x64
 
 

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

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
Generator

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
Captain Zero

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
Generator

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
Chappy

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
Dzomlija

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
sup3rsprt

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
AlexRD

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





Similar help and support threads
Thread Forum
How to run a batch file at logoff & some batch scripting help please
Hiya, I'd just like to run a simple batch file at logoff to backup some settings. I plan to use Robocopy, which is what i use to more thorough backups. Two questions: 1. How make it run by clicking Start > Shutdown? (i realise i could make a shutdown batch file and run it instead, but i'd...
Backup and Restore
I need admin permission to delete/move file (but I'm both admin/owner)
Hi, I'm new to Windows 7. I'm still trying to master the file permissions.. I need some help and I'd appreciate it if someone could help me out. I have a folder with mp3s (created with my old Windows XP system). I've included this mp3s folder in the "my music" library and then I inspected...
System Security
Launch batch file from the context menu in admin mode
Hi, I found a registry script that creates an option on the windows explorer context menu that allows you to run a batch file. The program that I use within the batch file is producing an access denied error which I dont get if I run the batch file normally. I wondered if this was something to...
General Discussion
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
Admin privileges in batch script
Hallo, I wrote a Script that uninstalls an application, move some files and install an Application. The Script is working if I start it as Admin (right click - run as Admin ...). Everything works fine. But I want to have it working without the "run as". The script is only used in a...
Software
Admin rights for batch
I got a batch script which needs Admin privileges. For example it installs some Programmes or move/copy files to/from System directories. So on Windows 7 (and Vista) I can say "Run as" and I got a Message like "are you sure allowing ... bla" OK/Cancel? But how I can get arround this MSG-Box?...
Software

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 20:26.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App