1.

Solve : DOS Batch File Parameters?

Answer»

Having TROUBLE referencing parameter values in Called Batch File: Anyone have a SOLUTION?

::Batch File 1
For %%p IN (c:\crala-data\trans*.txt) DO Call pocvrun.BAT %%p
::Called Batch File
erase f:\fmscrala\fms\home\upsidepo.txt
copy %%p f:\fmscrala\fms\home\upsidepo.txt

DOS throws error - does not recognize %%p in 2nd file
You may have to use a subroutine to set an environmental variable to the value p, then call the second BAT file. Your command shell version may not pass dynamic variables between shells, but the ENVIRONMENT is spawned to daughter shells. Or you could call the variable as %1 instead of %%p in the second file, as it has been entered as the first parameter of the file command.



Discussion

No Comment Found