Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista Tutorial - Pipe a pipe command to a file

Reply
 
Old 07-15-2008   #1 (permalink)
WB
Guest


 
 

Pipe a pipe command to a file

I couldn't find any better place to post this, so here it is:

I'm trying to find a way to echo a pipe command (>>) to a file.

Basically I'm trying to have one batch file create another batch file on the
fly. Unfortunately one of the commands already has a pipe command in it:

FOR /F %%I IN ('%1') DO ECHO %%~I >>%2

So to pipe it to a batch file, I would normally do this:

echo FOR /F %%I IN ('%1') DO ECHO %%~I >>%2 >> c:\test.bat

Unfortunately this fails because there are two sets of pipe commands (>>) in
the line.

Is there a way around this, maybe a way to specify ASCII characters in place
of >>?

Thanks,
--
Bill Baker

My System SpecsSystem Spec
Old 07-15-2008   #2 (permalink)
WB
Guest


 
 

RE: Pipe a pipe command to a file

Found the answer: had to preceed all special characters with a caret (^).
This includes the %, (, ), and > characters.
--
Bill Baker


"WB" wrote:
Quote:

> I couldn't find any better place to post this, so here it is:
>
> I'm trying to find a way to echo a pipe command (>>) to a file.
>
> Basically I'm trying to have one batch file create another batch file on the
> fly. Unfortunately one of the commands already has a pipe command in it:
>
> FOR /F %%I IN ('%1') DO ECHO %%~I >>%2
>
> So to pipe it to a batch file, I would normally do this:
>
> echo FOR /F %%I IN ('%1') DO ECHO %%~I >>%2 >> c:\test.bat
>
> Unfortunately this fails because there are two sets of pipe commands (>>) in
> the line.
>
> Is there a way around this, maybe a way to specify ASCII characters in place
> of >>?
>
> Thanks,
> --
> Bill Baker
My System SpecsSystem Spec
Old 07-15-2008   #3 (permalink)
Al Dunbar
Guest


 
 

Re: Pipe a pipe command to a file


"WB" <WB@xxxxxx> wrote in message
news:71D0B6A2-F79A-4764-AAFE-432460E62E66@xxxxxx
Quote:

>I couldn't find any better place to post this, so here it is:
That is batch script, this is a vbscript newsgroup. If you have other
questions to ask I'd suggest you go to
microsoft.public.win2000.cmdprompt.admin. Yes there are people here who
likely can answer such questions, but you will get lots more assistance in
the other group.

/Al
Quote:

> I'm trying to find a way to echo a pipe command (>>) to a file.
>
> Basically I'm trying to have one batch file create another batch file on
> the
> fly. Unfortunately one of the commands already has a pipe command in it:
>
> FOR /F %%I IN ('%1') DO ECHO %%~I >>%2
>
> So to pipe it to a batch file, I would normally do this:
>
> echo FOR /F %%I IN ('%1') DO ECHO %%~I >>%2 >> c:\test.bat
>
> Unfortunately this fails because there are two sets of pipe commands (>>)
> in
> the line.
>
> Is there a way around this, maybe a way to specify ASCII characters in
> place
> of >>?
>
> Thanks,
> --
> Bill Baker

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Using pipe in Powershell PowerShell
Pipe Yes or No to cmdlet PowerShell
Send command line via WMI - Pipe output to text file on remote mac PowerShell
Re: Send command line via WMI - Pipe output to text file on remote PowerShell
Unable to pipe result to a file in DOS Vista security


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46