【问题标题】:Write a batch file to do call another batch file and install a program编写一个批处理文件来调用另一个批处理文件并安装一个程序
【发布时间】:2014-10-28 14:46:36
【问题描述】:

我在处理批处理文件时遇到了问题。我有 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'"

我被困住了,任何帮助将不胜感激。谢谢

【问题讨论】:

  • 批量收到什么错误?

标签: windows batch-file cmd


【解决方案1】:

由于我们不知道“它停止”是什么意思,或者“它停止”在哪里,我猜

CALL "C:\testing\Instructions.rtf"

应该是

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

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

【讨论】:

    最近更新 更多