Question on Not So basic macros
Posted: 18 Jul 2011 16:54
If this works... (and it does)
Shouldn't this also work? (It doesn't)
Here is the actual command:
I can echo %CMD1%%CMD2%%CMD3% copy/paste and run the command. I can also comment my @echo off and copy/past the expanded and yet failed version of %CMD1%%CMD2%%CMD3% and it also runs fine.
Just trying to execute %CMD1%%CMD2%%CMD3% causes one of the commands to generate a syntax error, but I can't tell which one has the problem and it's difficult to take a step out of the middle and expect the rest of them to work properly so going that route will be difficult.
If I use CALL %CMD1%%CMD2%%CMD3% I get no error message, but nothing happens either. I put a pause after it and all I got was the "press any key to continue..." message.
At this point, I am guessing that there is something I need quoted or something I need to escape that is not necessary inside a FOR /F loop but is necessary if I just want to run the command from the prompt.
Any help would be appreciated...
Code: Select all
FOR /F "tokens=1-26 delims=," %%a IN ('%CMD1%%CMD2%%CMD3%') DO (commands)
Shouldn't this also work? (It doesn't)
Code: Select all
%CMD1%%CMD2%%CMD3%
Or even:
Call %CMD1%%CMD2%%CMD3%
Here is the actual command:
Code: Select all
Set "CMD1=CSVfix read_fixed -f 1:10^,11:32^,57:20^,91:4^,96:25^,125:6 reports\report.rtf"
Set "CMD2= ^| CSVfix trim ^| CSVfix edit -e "s/,/;/g" ^| CSVfix Remove -f 1 -ei "PAGE" ^| CSVfix Remove -f 1 -ei "CUSTOMER""
Set "CMD3= ^| CSVfix eval -e "(len($6^)^)" ^| CSVfix remove -f 7 -e "0" ^| CSVfix exclude -f 7 ^| CSVFix lookup -f 6:1 reports\codes.csv"
I can echo %CMD1%%CMD2%%CMD3% copy/paste and run the command. I can also comment my @echo off and copy/past the expanded and yet failed version of %CMD1%%CMD2%%CMD3% and it also runs fine.
Just trying to execute %CMD1%%CMD2%%CMD3% causes one of the commands to generate a syntax error, but I can't tell which one has the problem and it's difficult to take a step out of the middle and expect the rest of them to work properly so going that route will be difficult.
If I use CALL %CMD1%%CMD2%%CMD3% I get no error message, but nothing happens either. I put a pause after it and all I got was the "press any key to continue..." message.
At this point, I am guessing that there is something I need quoted or something I need to escape that is not necessary inside a FOR /F loop but is necessary if I just want to run the command from the prompt.
Any help would be appreciated...