batch-file - .bat 可以在基于 NT 的 Windows 中运行,但不能在 DOS 或 9x 中运行?

标签 batch-file windows-xp cmd dos windows-98

我为旧版 DOS 系统编写了一个批处理文件,用于不在 Win32 上运行的游戏。该代码在 XP x86 下运行良好,但当我在 98SE 或 DOS 中运行它时,我在第一次提示后收到语法错误。由于 goto,该文件运行到一个循环中。我该如何解决?

源代码:

@echo off
:PROMPT
cls
echo.
echo  Welcome to the Game Selection Wizard!
echo  --------------------------------------
echo.
echo  Please Select a Game: 
echo.
echo  1. Game1
echo  2. Game2
echo  3. Return To MS-DOS
echo.
set /p GAME= Your Current Selection: 
if %game%==1 goto Game1
if %game%==1. goto Game1
if %game%==2 goto Game2
if %game%==2. goto Game2
if %game%==3 goto QUIT
if %game%==3. goto QUIT
goto INVALID
:INVALID
cls
echo.
echo  * * * * * * * * * * * * * * * * * * * * * * * * * * *
echo  *                                                   *
echo  * ERROR:                                            *
echo  * ------                                            *
echo  * The choice you selected is wrong. Try Again!      *
echo  *                                                   *
echo  * * * * * * * * * * * * * * * * * * * * * * * * * * *
echo.
echo  Welcome to the Game Selection Wizard!
echo  -------------------------------------
echo.
echo  Please Select a Game: 
echo.
echo  1. Game1
echo  2. Game2
echo  3. Return To MS-DOS
echo.
set /p gameerror= Your Current Selection: 
if %gameerror%==1 goto Game1
if %gameerror%==1. goto Game1
if %gameerror%==2 goto Game2
if %gameerror%==2. goto Game2
if %gameerror%==3 goto QUIT
if %gameerror%==3. goto QUIT
cls
goto INVALID
:Game1
cls
call A:\GAMES\Game1.exe
goto PROMPT
:Game2
cls
call A:\GAMES\Game2.exe
goto PROMPT
:QUIT
cls
echo.
echo  Are you sure you want to return to MS-DOS?
echo.
set /p quit= Confirmation: 
if %quit%==y goto DIE
if %quit%==Y goto DIE
if %quit%==yes goto DIE
if %quit%==Yes goto DIE
if %quit%==YES goto DIE
if %quit%==n goto PROMPT
if %quit%==N goto PROMPT
if %quit%==no goto PROMPT
if %quit%==No goto PROMPT
if %quit%==NO goto PROMPT
goto QUITERROR
:QUITERROR
cls
echo  * * * * * * * * * * * * * * * * * * * * * * * * * * *
echo  *                                                   *
echo  * ERROR:                                            *
echo  * ------                                            *
echo  * The choice you selected is wrong. Try Again!      *
echo  *                                                   *
echo  * * * * * * * * * * * * * * * * * * * * * * * * * * *
echo.
echo  Are you sure you want to return to MS-DOS?
echo.
set /p quiterror= Confirmation: 
if %quiterror%==y goto DIE
if %quiterror%==Y goto DIE
if %quiterror%==yes goto DIE
if %quiterror%==Yes goto DIE
if %quiterror%==YES goto DIE
if %quiterror%==n goto PROMPT
if %quiterror%==N goto PROMPT
if %quiterror%==no goto PROMPT
if %quiterror%==No goto PROMPT
if %quiterror%==NO goto PROMPT
goto QUITERROR
:DIE
cls
echo.
echo  Returning to MS-DOS...

最佳答案

AFFAIR - 这是很久以前的事了 - SET/P 不是唯一的。

关于batch-file - .bat 可以在基于 NT 的 Windows 中运行,但不能在 DOS 或 9x 中运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15286854/

相关文章:

cmd - 如何获取Windows服务的动态PID然后杀死它?

node.js - 如何将 jsnode 子进程输出重定向到 cmd 提示符?

windows - 为什么 visual studio 2012 不能安装在 windows xp 中?

python - 如何在 cv2.VideoWriter 中使用 FPS 参数?

vba - 从 VBA 向 cmd 行发送 key 会丢失特殊 key

windows - 创建可以处理多个文件拖放的批处理文件

java - 如何捕获批处理执行的 EXE 返回的数据?

windows - 在类型命令批处理文件中隐藏文件名

batch-file - bat 文件来卸载已安装的应用程序

c# - 用可用字体列表填充 ComboBox