ironpaw has asked for the wisdom of the Perl Monks concerning the following question:
any ideas?system('runas /user:administrator cmd'); sleep2; system('thepassword'); sleep2; system('echo did it work?'); but naturally the system waits until runas has finished before going o +n. VBS handles it like this set WshShell = CreateObject("WScript.Shell") WshShell.Run "C:\Winnt\System32\Runas.exe /USER:administrator cmd" WScript.Sleep 2000 '1 Send keys to enter password. WshShell.SendKeys "thepassword" WScript.Sleep 580 '1 Send Enter key. WshShell.SendKeys "{Enter}" WScript.Sleep 500 '1 Send other keys. WshShell.SendKeys "echo commands here run in admin mode" WScript.Sleep 500
Edit by tye to replace password
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sending test to command prompt
by Mr. Muskrat (Canon) on Feb 18, 2003 at 21:46 UTC | |
by ironpaw (Novice) on Feb 18, 2003 at 23:07 UTC | |
by graff (Chancellor) on Feb 19, 2003 at 05:42 UTC | |
|
Re: sending test to command prompt
by Limbic~Region (Chancellor) on Feb 18, 2003 at 21:54 UTC | |
by ironpaw (Novice) on Feb 18, 2003 at 22:42 UTC |