prog2.bat controls the external prog1.exe

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
aSlavonian
Posts: 3
Joined: 25 Jan 2014 17:33

prog2.bat controls the external prog1.exe

#1 Post by aSlavonian » 25 Jan 2014 17:55

Please Help me,
I use interactive qbasic prog5.exe that after starting (the win_xp) requirements six times data input via keyboard. After that, do its job and prints text and diagram on the screen. Please help to make Start5.bat command that would be accomplished automatically with the prepared data into text*.txt files located on the C: drive.

I apologize for my poor English use- ogle translator
thank you

my idea?

Start5.bat

C: \ PROG5.EXE '' contents of files
<TYPE TEXT1.TXT '' text1 = "FX1"?
<TYPE TEXT2.TXT '' text2 = "C:\CMK15.TXT"
<TYPE TEXT3.TXT '' text3 = "YX3"
<TYPE TEXT4.TXT '' text4 = "YX4"
<TYPE TEXT5.TXT '' TEXT5 = "12"
<TYPE TEXT6.TXT '' TEXT6 = "ENGINESTARTER"

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: prog2.bat controls the external prog1.exe

#2 Post by foxidrive » 26 Jan 2014 04:01

The solution depends on the program. Some allow redirection and piping of text and others don't.

Code: Select all

@echo off
(
echo FX1
echo C:\CMK15.TXT
echo YX3
echo YX4
echo 12
echo ENGINESTARTER
)|PROG5.EXE

aSlavonian
Posts: 3
Joined: 25 Jan 2014 17:33

Re: prog2.bat controls the external prog1.exe

#3 Post by aSlavonian » 26 Jan 2014 08:12

foxidrive wrote:The solution depends on the program. Some allow redirection and piping of text and others don't.

Code: Select all

@echo off
(
echo FX1
echo C:\CMK15.TXT
echo YX3
echo YX4
echo 12
echo ENGINESTARTER
)|PROG5.EXE


I started this prog.bat but prog5.exe did not collect data FX1,..,.. from echo commands. The first thing it asked for, was to re-input via the keyboard. There is no change, it remains the same, like I directly started prog5.exe.
Is there any chance to automate it over prog.bat command.
thank you

regards

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: prog2.bat controls the external prog1.exe

#4 Post by foxidrive » 26 Jan 2014 08:29

You can try this but it may be the same. This assumes that you don't have any poison characters in your input data like & ) % etc.

Another option is an AutoIt script.

Code: Select all

@echo off
(
echo FX1
echo C:\CMK15.TXT
echo YX3
echo YX4
echo 12
echo ENGINESTARTER
)>file.txt

PROG5.EXE <file.txt

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: prog2.bat controls the external prog1.exe

#5 Post by Squashman » 26 Jan 2014 08:45

Usually helps to know what the name of the program is. For all we know the prgram can take command line arguments and it then is just a matter of looking at the help for the program to learn the syntax.

einstein1969
Expert
Posts: 976
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: prog2.bat controls the external prog1.exe

#6 Post by einstein1969 » 26 Jan 2014 10:41

aSlavonian wrote:Please Help me,
I use interactive qbasic prog5.exe that after starting (the win_xp) requirements six times data input via keyboard. After that, do its job and prints text and diagram on the screen. Please help to make Start5.bat command that would be accomplished automatically with the prepared data into text*.txt files located on the C: drive.

I apologize for my poor English use- ogle translator
thank you

my idea?

Start5.bat

C: \ PROG5.EXE '' contents of files
<TYPE TEXT1.TXT '' text1 = "FX1"?
<TYPE TEXT2.TXT '' text2 = "C:\CMK15.TXT"
<TYPE TEXT3.TXT '' text3 = "YX3"
<TYPE TEXT4.TXT '' text4 = "YX4"
<TYPE TEXT5.TXT '' TEXT5 = "12"
<TYPE TEXT6.TXT '' TEXT6 = "ENGINESTARTER"


If you can use cscript, you can use "sendkeys"

einstein1969

aSlavonian
Posts: 3
Joined: 25 Jan 2014 17:33

Re: prog2.bat controls the external prog1.exe

#7 Post by aSlavonian » 26 Jan 2014 11:30

foxidrive wrote:You can try this but it may be the same. This assumes that you don't have any poison characters in your input data like & ) % etc.

Another option is an AutoIt script.

Code: Select all

@echo off
(
echo FX1
echo C:\CMK15.TXT
echo YX3
echo YX4
echo 12
echo ENGINESTARTER
)>file.txt

PROG5.EXE <file.txt


My input data are exactly as I stated them respectively. After launching direct prog5.exe I typing for

the first input FX1 enter
the second input C:\CMK15.TXT enter
the third input YX3 enter
the fourth input YX4 enter
the fifth input 12 enter
the sixth input ENGINESTARTER enter

thereafter prog5.exe do its job

Post Reply