View Single Post
Old 07-15-2008   #2 (permalink)
WB


 
 

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