Page 1 of 1

help - prompt for password

Posted: 24 Jan 2012 20:40
by bell282
I am attempting to create a batch file that runs an exe. When the exe starts, I am prompted for a password. Can I script it to enter in the password? This is something I need to do daily, so it would be very nice if it could be automated. Any guidance would be greatly appreciated.

best,
bell

Re: help - prompt for password

Posted: 24 Jan 2012 23:14
by Liviu
If the exe reads the password off its "standard input stream" you may try "echo yourpassword| yourexe". However, if it's reading it directly off the interactive console, or if it's a GUI app with no console whatsoever, that won't work.

And, just saying, but I wouldn't hardcode a plaintext password in a batch file.

Liviu

Re: help - prompt for password

Posted: 25 Jan 2012 06:41
by bell282
thanks, but it didn't work :( There has to be a way to automate this! I will keep looking around.

Re: help - prompt for password

Posted: 25 Jan 2012 15:25
by Ed Dyreen
'
Maybe $ParamRAW

Code: Select all

my.exe -h
my.exe -help
my.exe -?
my.exe /?
my.exe ...I forget...
If that don't work, you are out of luck, that is using DOS

Interface the GUI http://www.autoitscript.com/site/autoit/

Code: Select all

SleepTiming_ReSet ()
While 1
   ;
   SleepTiming_Go ()

   $Title    = $ParTitle
   $Text    = $ParText
   If WinExists ( $Title, $Text ) Then ExitLoop
   ;
   $Title    = 'Internet Explorer'
   $Text    = 'Internet Explorer is momenteel niet de standaardbrowser.'
   If WinExists ( $Title, $Text ) _
   And WinActivate ( $Title, $Text ) _
   And ControlFocus ( $Title, $Text, 'Button2' ) _
   And ControlClick ( $Title, $Text, 'Button2' ) _
   Then WinWaitClose ( $Title, $Text )

WEnd
I won't advise vbscript, GUI interaction is insecure ( risk of misses ).

Re: help - prompt for password

Posted: 25 Jan 2012 16:45
by orange_batch
Answered the same question a number of times recently: viewtopic.php?f=3&t=2677&p=12235#p12235