我想制作一个游戏,在电脑上,您输入1
来获取文件,但是如果您随意输入诸如d
之类的内容,则会关闭窗口。我该如何解决?
我的代码:
set /p Location=Where do you want to go:
goto %Location%
echo
,位于顶部。好的,不用担心,这是重复的,我已经得到了答案。
答案 0 :(得分:0)
例如:
@echo off
echo.
echo Where do you want to go?
echo.
echo 1 file1
echo 2 file2
echo 3 file3
echo.
set /p Location="User input:"
if "%Location%" == "1" goto file1
if "%Location%" == "2" goto file2
if "%Location%" == "3" goto file3
pause >nul
:file1
:file2
:file3