The quotes are important because of what they do: Without them, the shell catches the pipe before the shell you're invoking (cmd.exe) even sees them.
Without quotes:
{ C:\Windows\System32\cmd.exe /c c:\test\slowproc.cmd } | tee.exe proc
+esslog
with quotes (hopefully):
C:\Windows\System32\cmd.exe /c { " c:\test\slowproc.cmd | tee.exe proc
+esslog " }
If you could get rid of the call to tee.exe, you could get rid of using cmd.exe too. Much as I dislike it when a monk rashly suggests the OP turn left after requesting help with turning right, here goes:
Instead of the cmd.exe/tee.exe adventure, have you considered using Perl's fork(), then in the child process:
open CMD, "slowproc.cmd|";? You could then write anything you get on <CMD> to STDOUT and a log file. (OK, my Camel is at work, so I'm hoping that I did that right from memory. I will trust the other monks to gently correct if not.)
If you're not interested in going down the fork()'ed path, the other option would be to create a wrapper.cmd that invokes slowproc.cmd with the pipe. Then ask cmd.exe to run wrappers.cmd.
Hope this helps.
--
Spring: Forces, Coiled Again!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.