Link to home
Start Free TrialLog in
Avatar of RichNH
RichNH

asked on

Run a Bat file as Administrator when I log in

I have a bat file on my desktop in a Win7 Home Premium 64-bit OS.  Every time I log in I right click this file and run it as Administrator.  I'd like to know how I can set it up to run automatically when I log in.  It does need to run as the Admin.

Thanks in advance.
Avatar of aadih
aadih
Flag of United States of America image

Put a shortcut to the file in startup folder.  Also right click the shortcut -> properties -> compatibility tab -> check "run this program as an administrator."

If you need help about startup folder, look here:

http://www.sevenforums.com/tutorials/1401-startup-programs-change.html >
ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
do the following:
go to start - run and type gpedit.msc
go to user configuration - windows settings - scripts (logon / logoff) - logon - add, and browse to your .BAT file and click ok.

now whenever a user logs in, the scripts will run automatically.
Right-click batch file, properties, compatibility, change settings for all users. T

Tick run as admin box.

Move batch file to windows startup in All Programs
The scheduled task solution is the best because it elevates automatically.
Avatar of RichNH
RichNH

ASKER

Well, I tried setting the batch file and the shortcut file to run as Admin while in the properties>CompatabilityMode, but the checkbox that would allow me to do that was not active so I couldn't.  I tried to move a copy of the shortcut to the bat file to the Startup folderand was told that that folder is off limits.   Strange since my account is an Administrator account and also strange since I also tried to do it in the Administrator account.  I thought Admin privs meant access to everything.  

Next I'll look into how to create a scheduled task.  You guys gotta realize, I'm pretty ignorant about Windows operating systems so be patient.  :-)
Avatar of RichNH

ASKER

Thanks for the suggestion, it works like a charm.