如何编写一个批处理文件,该批处理文件获取输入变量并将其发送到另一个要处理的批处理文件。
第1批
我不知道如何将变量发送到批次2,这是我的问题。
第2批
if %variable%==1 goto Example
goto :EOF
:Example
echo YaY
您根本不需要做任何事情。在批处理文件中设置的变量在其调用的批处理文件中可见。
例
@echo off
set x=7
call test2.bat
set x=3
call test2.bat
pause
echo In test2.bat with x = %x%.
...当test1.bat运行时。
In test2.bat with x = 7.
In test2.bat with x = 3.
Press any key to continue . . .
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句