Run batch file as administrator... always.

DrDamnit
DrDamnit used Ask the Experts™
on
I have a batch file that modifies the hosts file so that I can choose between a dev server and a production server for a CRM application I am developing. On Vista, I have no problems. Win7, however, gives me an access denied problem AND doesn't let me set the batch file to always run as administrator.

I cannot right click > Run As Administrator, because the batch file accepts an argument; "on" to turn dev server on, and "off" to turn it off. So, it must be run from the command line.

How do I fix this?

I just want to type:

devserver on

or

devserver off

and have it work.
Capture.PNG
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Type CMD in instant search, it will show you CMD in the search results, right click and choose run as administrator. This will open up command from in admin mode. You may run batch file there. See reference image.
CMD.jpg
Most Valuable Expert 2012

Author

Commented:
Let me re-phrase:

I want to hit Windows+R, and in the run box type "devserver on", and then have it work.
Commented:
Easy as... 123, Or as simple as... Do re Mi, ABC, 123 Baby you and me Girl!

Turn off UAC, and reboot

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial