Page 1 of 1

Batch problem

PostPosted: 29 Oct 2005, 10:33
by Guenther Simon
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

Re: Batch problem

PostPosted: 29 Oct 2005, 12:02
by Ross Boyd
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

Re: Batch problem

PostPosted: 29 Oct 2005, 14:39
by Guenther Simon
Thanks Ross, I will try your suggestion. :)

Best regards,
Guenther

Re: Batch problem

PostPosted: 29 Oct 2005, 17:41
by Anonymous
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

Re: Batch problem

PostPosted: 29 Oct 2005, 18:00
by Anonymous
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

Re: Batch problem

PostPosted: 29 Oct 2005, 18:22
by Guenther Simon
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