help - prompt for password

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
bell282
Posts: 2
Joined: 24 Jan 2012 20:35

help - prompt for password

#1 Post by bell282 » 24 Jan 2012 20:40

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

Liviu
Expert
Posts: 470
Joined: 13 Jan 2012 21:24

Re: help - prompt for password

#2 Post by Liviu » 24 Jan 2012 23:14

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

bell282
Posts: 2
Joined: 24 Jan 2012 20:35

Re: help - prompt for password

#3 Post by bell282 » 25 Jan 2012 06:41

thanks, but it didn't work :( There has to be a way to automate this! I will keep looking around.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: help - prompt for password

#4 Post by Ed Dyreen » 25 Jan 2012 15:25

'
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 ).

orange_batch
Expert
Posts: 442
Joined: 01 Aug 2010 17:13
Location: Canadian Pacific
Contact:

Re: help - prompt for password

#5 Post by orange_batch » 25 Jan 2012 16:45

Answered the same question a number of times recently: viewtopic.php?f=3&t=2677&p=12235#p12235

Post Reply