batch-file - 在 BATCH 文件中的引号内传递引号
问题描述
我一直在寻找解决这个问题的方法,但到目前为止我一直没有成功。我正在尝试使用批处理文件打开两个程序。问题是这些文件的两个路径都包含空格,并且这些路径之一已经用引号引起来。因为第二个文件(.gh 文件)没有打开。我已经尝试将第二条路径放在引号中,并使用\
字符转义引号,但没有任何结果。任何帮助表示赞赏。
@ECHO OFF
cd C:\Users\\Google Drive\Rhino Werk\MT1458\WIP
"C:\Program Files\Rhino 6\System\Rhino.exe" /nosplash /runscript="-grasshopper editor load document open C:\Users\<username>\Google Drive\Rhino Werk\MT1458\WIP\MT1458_HullGenerator_V2.64_NAKIJKMODEL.gh _enter" "C:\Users\<username>\Google Drive\Rhino Werk\MT1458\WIP\MT1458_HullGenerator_V2.59_001.3dm"
解决方案
@ECHO OFF
cd /d "C:\Users\\Google Drive\Rhino Werk\MT1458\WIP"
"C:\Program Files\Rhino 6\System\Rhino.exe" /nosplash /runscript="-grasshopper editor load document open \"%userprofile%\Google Drive\Rhino Werk\MT1458\WIP\MT1458_HullGenerator_V2.64_NAKIJKMODEL.gh\" _enter \"%userprofile%\Google Drive\Rhino Werk\MT1458\WIP\MT1458_HullGenerator_V2.59_001.3dm\""
这将遵循使用反斜杠转义内部双引号的 C++ argv 规则。这是否有效尚不清楚,因为我没有或使用 Rhino。
推荐阅读
- angular - 具有多行选择的 Ag-Grid 多行编辑
- google-apps-script - 在 Apps 脚本中获取 Gmail URL ID
- nested - 减少javascript中的嵌套对象数组
- javascript - 值未在 NodeJS 外部定义的变量中设置
- arrays - 比较两个 ByteArrayInputStream 进行常规测试
- linux - 如何强制 automake 将共享对象复制到 /usr/local/lib?
- angular - 切换两个表的顺序时垫排序不起作用
- python - 将邻接矩阵转换为向量
- sql - SQL - 查看经理是否向他正在管理的员工报告
- node.js - 是否可以在仓库中克隆仓库并只提交到内部仓库?