编写批处理文件来调用另一个批处理文件并安装程序

时间:2014-10-28 14:46:36

标签: windows batch-file cmd

我遇到批处理文件问题。我有第一批文件运行的2个文件,它创建目录并复制所需的文件。它似乎正确调用第二个批处理文件,因为它打开instructions.txt但随后停止。我将从CD运行第一批文件,然后从C:\ testing文件夹运行dbinstall.bat。

这是我的setup.bat

    @echo off

    md "C:\testing"

    xcopy *.* C:\testing

    CALL "C:\testing\dbinstall.bat"

反过来应该调用并运行此

    REM ***PLEASE REPLACE %DWVerFileName.exe WITH THE PROPER VERSION OF THE EXE FILE***
    REM ***MAKE SURE THE 7z FILE INCLUDES THE CUSTOMER NAME AND THEN CHANGE %filename%.7z TO THE FILE NAME***

    CALL "C:\testing\Instructions.rtf"

    start /b /wait "C:\testing\7z423.exe"

    SET AppExePath="%ProgramFiles(x86)%\7-zip\7z.exe"
    IF NOT EXIST %AppExePath% SET AppExePath="%ProgramFiles%\7-zip\7z.exe"
    %AppExePath% e database.7z

    start /b /wait "setup.exe"

    SQLCMD -E -S touch -Q "RESTORE DATABASE testing FROM DISK='C:\testing\database.bak'"

我被困住了,任何帮助都会受到赞赏。感谢

1 个答案:

答案 0 :(得分:1)

因为我们不知道"它会停止"意味着,或者它停止的地方",我猜

CALL "C:\testing\Instructions.rtf"

应该是

start "instructions" "C:\testing\Instructions.rtf"

然后会调用与.rtf关联的任何程序,毫无疑问会在7z423可执行文件运行时放弃指令并保持显示机制处于打开状态。