Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do I create a .cmd file including runas with password?

Status
Not open for further replies.
May 28, 2003
106
GB
Dear all,

i wrote a batch file to copy some programs from a mapped drive to the users c drive and to install them from there. One of the programs requires administrive rights to install and i used:
runas /noprofile /user:domainname\username c:\temp\pro.exe
Is there a way to make the batch use the password for this account automatically instead of stopping the process and asking for it?

Many thanks in advance and kind regards,
Sebastian
 
This is pretty much an educated guess, but it could work. Try this:
echo (your password) | runas /noprofile /user:domainname\username c:\temp\pro.exe

The piping SHOULD work. I was having some trouble on my 2k3 box, though. Be warned, though, that you will ahve to type your pass in cleartext. Anyone with above average computer intelligence could snag that, so you probably should use an account with a limited logon time and an expriation date. Good luck.
 
The tool on is similar like runas with password:
runasspc /program:"c:\temp\pro.exe" /domain:"domainname" /user:"testadmin" /password:"password"
you can also hide the password and all other options in an encrypt file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top