Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

I/O redirection with start command.

Feb
50
1
I have tied quite a few combinations but I was not able to redirect I/O from a start command. Something like:

Code:
START X.EXE >&X.out

With X.EXE beeing a GUI applications writing stuff the the console I don´t want to see normally (but keeping the output in a log file would be nice for debugging).

I found an article on CMD but the ^ trick described won´t work with TCMD.

Any hints or is it hopeless?

Martin
 
> Code:
> ---------
> START X.EXE >&X.out
> ---------
> With X.EXE beeing a GUI applications writing stuff the the console I
> don´t want to see normally (but keeping the output in a log file would
> be nice for debugging).

If the GUI app is creating its own console, then it's hopeless. Redirection
is done by the command processor, not by Windows, and in this case the
command processor would never be invoked.

If X.EXE is not creating a new console (and is not really a GUI app), you'd
need to use a command group to capture the output of X.EXE. (In your
example above, you're redirecting the output of START, not the output of
X.EXE.)

Rex Conn
JP Software
 
If the GUI app is creating its own console, then it's hopeless. Redirection
is done by the command processor, not by Windows, and in this case the
command processor would never be invoked.

If X.EXE is not creating a new console (and is not really a GUI app), you'd
need to use a command group to capture the output of X.EXE. (In your
example above, you're redirecting the output of START, not the output of
X.EXE.)

What if x.exe is a GUI app attaching to the console of its parent (AttachConsole(-1))? I wrote a little test (GUI) which did that and wrote "Hello world." both with WriteConsole() and with wprintf() (after setting up stdout). It works fine if I just give its name at the TCC command line but I can't figure out a way to capture its output (tried START /wait /b and command grouping). I couldn't do it with CMD either. Do you think it's possible?

The example the OP found was

Code:
START CMD /C essmsh CSR.build.outline.CSRCALC.mxl^>CSRCALC.LOG
But essmsh itself is a console app.
 
If the GUI app is creating its own console, then it's hopeless.

The very first line printed is:

The launcher has determined that the parent process has a console and will reuse it for its own console output. Closing the console will result in termination of the running program.

So it seems that the app does indeed attach to to existing console. As do most Java applications.

If X.EXE is not creating a new console (and is not really a GUI app), you'd
need to use a command group to capture the output of X.EXE.

The following two options did not work out:

Code:
(START X.EXE ) >&X.out
START (X.EXE  >&X.out)

So I guess it is all down to some Window-Magic as vefatica pointed out and the whole stuff is hopeless.
 
The following two options did not work out:

Code:
(START X.EXE ) >&X.out
START (X.EXE  >&X.out)
So I guess it is all down to some Window-Magic as vefatica pointed out and the whole stuff is hopeless.

The only way it could work is if the GUI app did some custom magic at startup to use the console handles passed by TCC. (I've never seen *any* GUI app other than TCMD that does this.)
 

Similar threads

Back
Top