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.