See Tom run. Run Tom run!
If you log into your Windows machine with a limited account there are times when you need to run a program with administrator privileges. There are couple options here, you can log out and log back in as the administrator but that's always a pain. You can right click and select "Run As" but that requires you to enter the administrator user name and password each time and can get annoying. There has to be a better way...
This handy batch file runs any program dropped onto it with alternate credentials. Just copy and past the following into a new batch file and replace "myusername" and "mydomain" with the appropriate information.
RunAs.bat
set LINK=%1
set LINK=%LINK:"=\"%
runas /savecred /user:myusername@mydomainname "cmd /c %LINK%"
The first time you run it it will ask for a password. Because the /savecred option is set you won't have to enter the password after that unless it changes. If you consider that a security risk just remove /savecred and it will ask you for the password each time it's run.
Labels: programming