Batch problem

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

Batch problem

Postby Guenther Simon » 29 Oct 2005, 10:33

How can I pipe the window output from another window started by
a batch file to a text file?
Somehow I only get results with empty files, probably it pipes
the bat window instead of the working window?

Code: Select all
e.g.
start/wait foo /flag1 /flag2 path\prog.exe > foo.txt


Code: Select all
or:
start/wait foo /flag1 /flag2 path\prog.exe
/wait  > foo.txt


doesn't work?

Regards,
Guenther
User avatar
Guenther Simon
 
Posts: 794
Joined: 26 Sep 2004, 19:49
Location: Regensburg, Germany

Re: Batch problem

Postby Ross Boyd » 29 Oct 2005, 12:02

Hi Guenther,

The problem is the "start" command. The pipe is applied to the start.exe instead of the actual command.

A workaround is to put the command in a batch file and then run it like so:
Code: Select all
start /wait foo.bat


foo.bat would contain:
Code: Select all
path\prog.exe > foo.txt


Hope this helps,

Ross
User avatar
Ross Boyd
 
Posts: 83
Joined: 26 Sep 2004, 23:07
Location: Wollongong, Australia

Re: Batch problem

Postby Guenther Simon » 29 Oct 2005, 14:39

Thanks Ross, I will try your suggestion. :)

Best regards,
Guenther
User avatar
Guenther Simon
 
Posts: 794
Joined: 26 Sep 2004, 19:49
Location: Regensburg, Germany

Re: Batch problem

Postby Anonymous » 29 Oct 2005, 17:41

G?nther, if foo.exe is a Windows console program (like many WB chess engines) or some old DOS program, you would not need start /wait at all. Just put

foo /flag1 /flag2 path\prog.exe > foo.txt

into the batch. If foo is a GUI type program, you cannot redirect the output.

The suggestion of Ross should work as well, of course.

Regards,
Dieter
Anonymous
 

Re: Batch problem

Postby Anonymous » 29 Oct 2005, 18:00

BTW. your command line looks suspicious, because of the path/prog.exe.

Do you really want to start foo? Or do you want to start path/prog.exe?

Your command line would mean, that path\prog.exe is a parameter to program foo.

Typical sample command lines would rather look like:

foo /flag1 /flag2 > foo.txt

or

path\foo /flag1 /flag2 > foo.txt

Regards,
Dieter
Anonymous
 

Re: Batch problem

Postby Guenther Simon » 29 Oct 2005, 18:22

Code: Select all
BTW. your command line looks suspicious, because of the path/prog.exe.

Do you really want to start foo? Or do you want to start path/prog.exe?

Your command line would mean, that path\prog.exe is a parameter to program foo.


Hi Dieter,

That part is correct, as path\prog is also a parameter for foo :)
BTW 'foo' is GradualTest and 'prog' is a chess program started by it
and it works as it should, except the pipe part, but it will
work with the indirection Ross suggested I guess.
With my batch I can run several tests for epds automatically
over night. I just want to save the whole debug output too,
because I can do further things with it.

Best regards,
Guenther
User avatar
Guenther Simon
 
Posts: 794
Joined: 26 Sep 2004, 19:49
Location: Regensburg, Germany


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 29 guests

cron