gpt4 book ai didi

batch-file - .bat 在基于 NT 的 Windows 中工作但在 DOS 或 9x 中不工作?

转载 作者:行者123 更新时间:2023-12-02 05:12:05 25 4
gpt4 key购买 nike

我为不在 Win32 上运行的游戏编写了一个用于旧 DOS 系统的批处理文件。该代码在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com