因此,我不知道这是否可能,但我希望能够从外部批处理调用内部批处理,并能够使用外部批处理在内部批处理中设置参数。例如,外部批处理文件具有outerParam1、outerParam2、outerParam3。然后,在内部批处理文件中,它设置自己的param1、param2、param3,等于外部批处理文件版本。
发布于 2015-12-07 22:59:05
在批处理文件中,只需在文件名之后添加参数,就可以调用另一个带有参数的批处理文件。例如,你可以有这样的东西;
outerbatch.bat:
@echo off
set "outerParam1=hello world"
set "outerParam2=!"
call innerbatch.bat "%outerParam1%" "%outerParam2%"innerbatch.bat:
@echo off
set "param1=%~1"
set "param2=%~2"
echo %param1% %param2%
pause这将使innerbatch.bat回显:
你好,世界
https://stackoverflow.com/questions/34143858
复制相似问题