Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: DOS Batch File Parameters  (Read 2843 times)

0 Members and 1 Guest are viewing this topic.

micropterus2

  • Guest
DOS Batch File Parameters
« on: November 05, 2004, 09:31:12 AM »
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

MalikTous

  • Guest
Re: DOS Batch File Parameters
« Reply #1 on: November 10, 2004, 05:56:06 AM »
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.
« Last Edit: November 10, 2004, 05:59:29 AM by MalikTous »