【问题标题】:how do you execute .exe programs inside cmd using a batch file如何使用批处理文件在 cmd 中执行 .exe 程序
【发布时间】:2013-05-27 23:12:44
【问题描述】:

我想制作一个 .bat 文件,它将在命令提示符内打开最近编译的 .exe 文件(我最近开始学习 c++,但是当我运行我的程序时,它会立即打开和关闭我的程序)我想要这个程序使用已编译 .exe 的路径运行我的书说使用 2 行方法制作批处理文件:

[Program.exe]  
[pause]  

但我想制作一个 bat 文件来打开任何命令提示符程序,然后停止我到目前为止:

    @ echo off
    echo "input addres of file"  
    set /P file_a=[promptString]  
    echo "opening file %file_a% is this right? [y/N]"  
    set /P input2=[promotString]  
    if (input2)==("n")  
    GOTO @ echo off
    if (input2)==("y")  
    call file_a  
    pause      

它不起作用,我能得到任何帮助吗?任何会很好。

附言我很确定 GOTO 语句是错误的

【问题讨论】:

    标签: batch-file cmd


    【解决方案1】:

    这是未经测试的:

    @echo off
    :start
    set "file_a="
    set "input2="
    set /P "file_a=input address of file "
    set /P "input2=opening file %file_a% is this right? [y/N] "
    if /i "%input2%=="n" goto :start  
    call "%file_a%"  
    pause     
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-16
      • 1970-01-01
      • 2013-10-03
      • 1970-01-01
      • 1970-01-01
      • 2021-04-20
      • 2017-02-15
      • 2015-07-12
      相关资源
      最近更新 更多