Batch file acts strangely

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
Here's a batch file I use from within DevEnv (long "dumpbin" lines may be wrapped).

window min
echo -
iff "%2" == "both" then
echos Before: Size: %@filesize[%1.prev]` `
dumpbin /headers %1.prev | egrep "virtual size|^ *\." | sed -e 's/virtual size//g' | sed -e 's/ name.*//g' | crunch
echos ^r^nAfter:` `
endiff
echos Size: %@filesize[%1]` `
dumpbin /headers %1 | egrep "virtual size|^ *\." | sed -e 's/virtual size//g' | sed -e 's/ name.*//g' | crunch
copy /q %1 %1.prev

When I run it from a DevEnv "external tool" with

Command: d:\tcmd9\tcc.exe
Params: /c u:\postbuild.bat $(TargetPath)

it bombs thus:

Size: 12288 TCC: U:\postbuild.bat [9] Unknown command "^ *\. | sed -e 's/virtual size//g' | sed -e 's/ name.*//g' | crunch"
TCC: (Sys) U:\postbuild.bat [10] The system cannot find the file specified.
"G:\Projects\plugsample\release\qbat.dll g"

If I give it a superfluous parameter,

Params: /c u:\postbuild.bat $(TargetPath) foo

it runs OK, producing the expected output:

Size: 12288 .text 17ED .rdata DCC .data 4104 .rsrc 1D8 .reloc 3D8

Any idea what's going on?