windows - 将带有参数的 bat(启动 cmd 窗口并将命令添加到路径)包含在另一个 bat 中
问题描述
我有一个运行命令的 bat 文件:
C:\Windows\System32\cmd.exe /E:ON /V:ON /K ""C:\Program Files (x86)\path\to\the\compilers\script.bat" option1 option2"
它基本上会打开一个 cmd 窗口,其中不同的命令(英特尔编译器等)已经在路径中。然后,在这个命令窗口中,我cd
到一个特定的位置,我使用这些 intel 命令如下:
ifort -c -fpp file1.f90
ifort -c -fpp file2.f90
ifort -c -fpp file3.f90
ifort -dll -o libfinal.dll file1.obj file2.obj file3.obj
lib /out:./libfinal.lib file1.obj file2.obj file3.obj
xcopy /s .\libfinal.dll "..\libfinal.dll*" /Y
xcopy /s .\libfinal.lib "..\libfinal.lib*" /Y
它编译(使用ifort
intel fortran 编译器,但问题不依赖于它)库并将它们复制到某处。
我会将以上所有内容打包成一个 bat 文件来完成整个工作。我想出了:
call ""C:\Program Files (x86)\path\to\the\compilers\script.bat" option1 option2"
ifort -c -fpp file1.f90
ifort -c -fpp file2.f90
ifort -c -fpp file3.f90
ifort -dll -o libfinal.dll file1.obj file2.obj file3.obj
lib /out:./libfinal.lib file1.obj file2.obj file3.obj
xcopy /s .\libfinal.dll "..\libfinal.dll*" /Y
xcopy /s .\libfinal.lib "..\libfinal.lib*" /Y
但运行它给了我以下信息:
'""C:\Program' is not recognized as an internal or external command
我检查了Command Prompt Error 'C:\Program' is not Recognized as an internal or external command, operable program or batch file但没有成功适应我的情况
评论。 option1
并且option2
没有空格或任何需要引用的内容,如果我使用call "C:\Program Files (x86)\path\to\the\compilers\script.bat" option1 option2
我有以下错误:
The input line is too long.
The syntax of the command is incorrect.
评论。该call
行的真实内容是:
call "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.4.210\windows\bin\ipsxe-comp-vars.bat" intel64 vs2015
解决方案
推荐阅读
- javascript - 在我的 Bowyer-Watson 算法的实现中,是什么使它成为 O(n^2) 或更糟,而不是像它应该的那样 O(n log n)?
- python - Dash - 间隔不调用回调
- javascript - 如何在按钮单击时打开/关闭功能?
- google-cloud-firestore - 使用 Firestore 规则验证数组
- linux - 如何在我的脚本中解释这个 BASH 语句?
- r - 修改数据框中变量的值
- php - 在搜索字符串周围使用通配符的 LIKE 子句查询返回所有行
- r - 自定义图例形状和大小 ggplot2
- swift - 在字典中搜索各种条件 Swift
- python-3.x - 为什么 is_closed 在重写版本中停止工作?