How to handle pop or manual input in an existing batch less touch the original scripts file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
goodywp
Posts: 265
Joined: 31 Jul 2017 09:57

How to handle pop or manual input in an existing batch less touch the original scripts file

#1 Post by goodywp » 01 Jun 2022 13:31

Hi all,

I have a complex scripts to do installation job. This scripts is mainly for manually run so that you can provide value for it or select the option to do then hit the enter to continue the job.
Now my question is if I want to run in command line without interactive response, in other words it will pick up the option or value by itself (or automatically).

I could think of two options
1) modify the scripts to use wanted value or option to pick..
2) or no touch the original scripts add some extra file to feed this script to do the automatic installation.

I prefer to use second choice since I do want to touch or modified the original one. If there is no choice other than to modify the original scripts then I will do..

Any thoughts?

Thanks

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: How to handle pop or manual input in an existing batch less touch the original scripts file

#2 Post by aGerman » 02 Jun 2022 10:49

Difficult to tell without knowing what scripts you're talking about. However
  • While a script is waiting for input its execution is interrupted. So, you need another asynchronously running process to somehow react and send the expected input exactly to the right window and exactly at the right time.
  • Pure Batch can't interact with a window. There's no native way to emulate mouse or keyboard input without using either another language or a 3rd party utility.
Thus, it would be probably far easier to update the scripts to accept command line arguments, or to expand variables defined in the main script.

Steffen

miskox
Posts: 630
Joined: 28 Jun 2010 03:46

Re: How to handle pop or manual input in an existing batch less touch the original scripts file

#3 Post by miskox » 03 Jun 2022 07:05

Steffen already summairezed it. But if you have only batch scripts you could use a special .txt file with prefedined answers (but in this way you have to copy these two files together). Or you could put them in a batch file itself. Of course some reprogramming must be done.

Saso

goodywp
Posts: 265
Joined: 31 Jul 2017 09:57

Re: How to handle pop or manual input in an existing batch less touch the original scripts file

#4 Post by goodywp » 03 Jun 2022 11:41

The main scripts attached. Also this script used a configure file called Factory.cfg (we can ignore the Customer.cfg)
What I need is to do below steps:
1) I need get rid of pop up (run command line only)
2) First need variable for com.
3) Have option 3 to do Clear Terminal, need get rid of "Enter" manual step by hitting the enter
4) when the above done, next is to do option 1 Load All with Profile
Download.zip
main batch file
(17.69 KiB) Downloaded 322 times
Factory.zip
configure file
(558 Bytes) Downloaded 299 times
Last edited by goodywp on 04 Jun 2022 11:42, edited 2 times in total.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: How to handle pop or manual input in an existing batch less touch the original scripts file

#5 Post by aGerman » 03 Jun 2022 14:57

goodywp wrote:
03 Jun 2022 11:41
What I need is to do below steps:
Sounds like you have some work to do :)

Steffen

goodywp
Posts: 265
Joined: 31 Jul 2017 09:57

Re: How to handle pop or manual input in an existing batch less touch the original scripts file

#6 Post by goodywp » 04 Jun 2022 11:41

goodywp wrote:
03 Jun 2022 11:41
The main scripts attached. Also this script used a configure file called Factory.cfg (we can ignore the Customer.cfg)
What I need is to do below steps:
1) I need get rid of pop up (run command line only)
2) First need variable for com.
3) Have option 3 to do Clear Terminal, need get rid of "Enter" manual step by hitting the enter
4) when the above done, next is to do option 1 Load All with Profile

Download.zipFactory.zip

goodywp
Posts: 265
Joined: 31 Jul 2017 09:57

Re: How to handle pop or manual input in an existing batch less touch the original scripts file

#7 Post by goodywp » 09 Jun 2022 08:02

FYI, I made a new simplified one. Thanks all!

Post Reply