I created a batch file that requires a 60 character password before it will execute
commands. I've got a script on a couple of USB sticks that display the password
in a text file. After the password appears it's copied and pasted into the batch
file window.
Ocassionally, the batch file window instantly closes after copying and pasting
the password. The commands it's suppose to execute are ignored. Rebooting
my computer usually fixes the problem. Why is this happening and is there a
solution?
Batch File Window Closing Too Soon
Moderator: DosItHelp
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Batch File Window Closing Too Soon
Without seeing the script, it's impossible to say.
Re: Batch File Window Closing Too Soon
Well, the batch file is encrypted for a reason. I'm a partner in a business, so I
can't upload the contents. I could create a similar batch file, that is not related
to my business.
I'm 90% certain this ocassional problem is a glitch with the operating system.
There is a workaround solution. The script that runs from the USB sticks could
be expanded. Instead of a manual copy and paste, the script would automatically
enter the 60 character password when the batch file window appears.
can't upload the contents. I could create a similar batch file, that is not related
to my business.
I'm 90% certain this ocassional problem is a glitch with the operating system.
There is a workaround solution. The script that runs from the USB sticks could
be expanded. Instead of a manual copy and paste, the script would automatically
enter the 60 character password when the batch file window appears.
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Batch File Window Closing Too Soon
The script is using SendKeys, isn't it? That's the only situation I've ever seen where scripts interact with GUIs, but only sometimes. You can generally get around SendKeys being a finicky piece of crap by throwing in Sleep commands between everything. It's not ideal, but it increases the success rate. A better solution is to use literally everything else, and it sounds like you managed to either take advantage of some command line parameters, or get lucky that you only needed to enter one bit of information that you could echo and pipe to the script. Either way, glad you got it working.