如何从批处理文件中调用带有标志的批处理文件

时间:2017-03-20 18:10:29

标签: windows batch-file cmd

我有一个批处理脚本,需要调用需要标志才能成功运行的其他批处理脚本。

:adobe_install
    echo 1. Adobe Reader & echo 2. Adobe Flash Player & echo 3. Adobe Acrobat
    set /p choice="What would you like to install[1-3]: "
    if %choice%==1 call "%adobe_path%\adobe.bat"
    rem if %choice%==2 call "%cd%\scripts/Adobe/adobe.bat /f"
    rem if %choice%==3 call "%cd%\scripts/Adobe/adobe.bat /a"

adobe批处理脚本需要一个标志才能成功运行,必须给出以下标志之一:/a,/r/f

如何在批处理脚本中运行批处理脚本和标志?

我尝试了什么:

if %choice%==1 call "%adobe_path%\adobe.bat"
# this works but only outputs the help menu of the script

if %choice%==1 call "%adobe_path%\adobe.bat /r"
# this will output "the syntax of the command is incorrect"

cd "%adobe_path%\scripts\Adobe"
if %choice%==1 call "\.adobe /r"
# same as above

if %choice%==1 start "%adobe_path%\adobe /r"
# launches another cmd and won't run the script

1 个答案:

答案 0 :(得分:2)

if %choice%==1 call "%adobe_path%\adobe.bat" /r

引用可执行文件(批处理文件)以允许名称中的空格。参数由空格(或逗号)

分隔