1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Start program without waiting and redirect output

Discussion in 'Support' started by David Marcus, Dec 29, 2010.

  1. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    648
    Likes Received:
    1
    How do I start a console program in a btm file, redirect its output, and have the btm file continue? I tried

    start "Title" /tab Foo.exe > Out.txt

    This doesn't work. In fact, sometimes Take Command stops working and then restarts. Also tried

    detach Foo.exe > Out.txt

    This doesn't work either.

    TCC 12.00.42 x64 Windows 7 [Version 6.1.7600]
     
  2. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    ---- Original Message ----
    From: David Marcus
    | How do I start a console program in a btm file, redirect its output,
    | and have the btm file continue? I tried
    |
    | start "Title" /tab Foo.exe > Out.txt
    |
    | This doesn't work. In fact, sometimes Take Command stops working and
    | then restarts. Also tried
    |
    | detach Foo.exe > Out.txt
    |
    | This doesn't work either.
    |
    | TCC 12.00.42 x64 Windows 7 [Version 6.1.7600]
    ---- End Original Message ----

    I would try this:

    Foo.exe > Out.txt

    --
    HTH, Steve
     
  3. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    648
    Likes Received:
    1
    I want the btm file to continue, not wait for Foo.exe to finish. I've got a program that takes several hours to run. I want to do several runs concurrently, since my computer has multiple cores. I can open tabs manually and paste the correct command into each, but it would be simpler for me if I could launch all the processes from a btm file.
     
  4. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,307
    Likes Received:
    39
    Perhaps:

    Code:
    start "Title" /tab %_cmdspec Foo.exe > Out.txt
    
    (I don't know anything about Foo.exe, but it probably doesn't expect redirection characters in its command line.)
     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,959
    Likes Received:
    30
    On Wed, 29 Dec 2010 11:55:49 -0500, David Marcus <> wrote:

    |How do I start a console program in a btm file, redirect its output, and have the btm file continue? I tried
    |
    |start "Title" /tab Foo.exe > Out.txt
    |
    |This doesn't work. In fact, sometimes Take Command stops working and then restarts. Also tried
    |
    |detach Foo.exe > Out.txt
    |
    |This doesn't work either.
    |
    |TCC 12.00.42 x64 Windows 7 [Version 6.1.7600]

    This, for example, works:

    Code:
    start /b %comspec /c netstat ^> netstat.txt
    Note, %comspec is needed to provide the redirection, /b prevents an unsightly
    new console, /c causes the new instance of TCC to exit when the (netstat)
    command has finished. and excaping the redirection symbol makes it part of the
    command sent to %comspec.
     
  6. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,959
    Likes Received:
    30
    On Wed, 29 Dec 2010 12:07:00 -0500, Steve Fábián <> wrote:

    |---- Original Message ----
    |From: David Marcus
    || How do I start a console program in a btm file, redirect its output,
    || and have the btm file continue? I tried
    ||
    || start "Title" /tab Foo.exe > Out.txt
    ||
    || This doesn't work. In fact, sometimes Take Command stops working and
    || then restarts. Also tried
    ||
    || detach Foo.exe > Out.txt
    ||
    || This doesn't work either.
    ||
    || TCC 12.00.42 x64 Windows 7 [Version 6.1.7600]
    |---- End Original Message ----
    |
    |I would try this:
    |
    | Foo.exe > Out.txt

    The BTM will wait for that to finish. He wants the BTM to continue while that
    happens.
     
  7. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    648
    Likes Received:
    1
    Thanks. That's just what I needed. I added quotes around %comspec. It also works with ^>&, if I want to redirect standard error, too.
     

Share This Page