disciple has asked for the wisdom of the Perl Monks concerning the following question:
I am attempting to execute a windows program that expects input from the user once started. I have tried using system and pass the value as one of the arguments, but this did not work because the program will not accept this data as a parameter.
The program in question is "runas". It is run like this:
runas /user:username "command to execute"
Once that command is started, it prompts for a password. The design of the tool does not allow the password to be passed as a parameter. (I am on Windows 2000)
I have tried this without success:
system('runas /user:username "net localgroup administrators %username% +@%userdnsdomain% /ADD"', 'password');
The response I get is:
*Enter password for oitcontractor\administrator:RUNAS ERROR: Unable to accept input
*'administrator' is not recognized as an internal or external command, operable program or batch file.
So then I thought I should try putting the password in backticks on the next line, and that doesn't work either. I know this is a long post for what should be a short question, but I wanted to show you that I have tried to solve this before asking you.
I did a supersearch for "windows program input" and found this, which mentions Win32::Console but I have not been able to figure out how to use it. Can anyone confirm that Win32::Console can accomplish this and point me to some decent examples. I read the perldoc on it and I am a bit confused. If it cannot then are there any other solutions?
Thanks, disciple
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Pass expected input to Windows program
by Thelonius (Priest) on Apr 02, 2004 at 20:50 UTC | |
Re: Pass expected input to Windows program
by quinkan (Monk) on Apr 03, 2004 at 02:14 UTC | |
by disciple (Pilgrim) on Apr 03, 2004 at 15:20 UTC | |
Re: Pass expected input to Windows program
by ant9000 (Monk) on Apr 03, 2004 at 09:32 UTC | |
by disciple (Pilgrim) on Apr 03, 2004 at 15:59 UTC | |
Re: Pass expected input to Windows program
by Plankton (Vicar) on Apr 02, 2004 at 21:11 UTC | |
by BUU (Prior) on Apr 02, 2004 at 21:59 UTC | |
Re: Pass expected input to Windows program
by mce (Curate) on Apr 05, 2004 at 10:01 UTC | |
Re: Pass expected input to Windows program
by amrangaye (Friar) on Apr 05, 2004 at 11:59 UTC | |
by disciple (Pilgrim) on Apr 05, 2004 at 19:55 UTC |