batch-file - DOSBox 中的 if 语句块与 Windows CMD 中的不同吗?
问题描述
我在 Windows 命令提示符 (CMD) 中创建了一个批处理文件,它可以工作。
考虑到 DOSBox 与 CMD 相同,我只是运行了相同的代码,但它不起作用。而且我注意到这些问题中所述可能存在一些差异。
这是批处理文件内容:
:: Hide commands
@echo off
:: Verbose usage
if "%1"=="" (
echo Usage: tpc [file]
echo file a Turbo Pascal file
goto eof
)
set file=%1
c:\tpwdb\bin\tpc %file%
echo.
echo Execute with %file%
:eof
在 CMD 中,它产生:
>tpc
Usage: tpc [file]
file a Turbo Pascal file
>tpc 02\hellow.pas
This version of c:\tpwdb\bin\TPC.EXE is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.
Execute with 02\hellow.pas
但在 DOSBox 中,它产生了:
>tpc
Illegal command: (.
Usage: tpc [file]
file a Turbo Pascal file
>tpc 02\hellow.pas
Usage: tpc [file]
file a Turbo Pascal file
这表明它没有识别 if block( )
并且当有一个参数传递时,它仍然执行该块但没有显示 message Illegal command: (.
。
解决方案
推荐阅读
- android-studio - 在 android studio 中打开项目,所有包/符号都标记为不正确
- visual-studio - 如何使用 VSTS 使用 VSTS 使用 Docker 配置 ASPNET Core 来构建、运行测试并使用单元测试和环境变量部署到 Azure
- matplotlib - Matplotlib plt 对象在绘图间共享
- ms-access - 访问 SELECT Me.HWND
- php - 引用 php 文档本身的 PHP 推断路径
- sql - 加入两个表后立即查询一半的结果
- linux - 从不对齐 RSP 的函数调用时,glibc scanf 分段错误
- asp.net-mvc - kendo mvc 编辑器未绑定到选定的下拉属性
- r - 在 rhandsontable 列中的开/关值之间切换
- javascript - PHP 表单:服务器响应状态为 400(错误请求)