Page 1 of 1

passing file names to bat files

Posted: Tue Aug 14, 2012 1:45 pm
by bill2009
I have two bat files set up to run as external tools. Both were added as Dos commands and the definitions look the same. in each case there's a single parameter $BaseName that gets subbed into a command in the bat file via %1. One of these (cca.bat) always works fine. The other, avdv.bat often fails to pass the parameter - %1 just subs in nothing. I've done things like deleting the tool and re-adding it and sometimes it works for a few tries then fails to substitute. An echo at the top of the bat file confirms that %1 is null.

Any ideas?

The two files are included below, each preceded by the "Parameters" entry. The "Command" entry is, in each case CMD.

avdv.bat $BaseName
avrdude -CC:\apps\arduino-0022\hardware/tools/avr/etc/avrdude.conf -patmega644p -cstk500v1 -P\\.\COM1 -b19200 -U flash:w:%1.hex:i -u -D

cca.bat $BaseName
cc1802 -I ..\include -rom -mem_config 1 -code_start 0 -data_start 8192 -nlb %1.c
@IF errorlevel 1 goto quit
asm1802 -format_intel %1.s
:quit

Posted: Thu Aug 16, 2012 4:04 pm
by bill2009
***********OK****************

I understand the behavior now. This will happen with any bat file substitution. If I change the content of the file I'm editing, $BaseName substitutes ok. If I have not changed the file it does not.

for example:
echoer.bat
echo %1

works once when the file is changed but not thereafter - clearly a bug rather than any error on my part.