这是我的问题:
:NNEEWW
cls
echo Where to save the file (Type "Desktop" or "Docs")
set /p SaveTo="Where to save: "
if "%SaveTo%" == "Desktop" goto DT
if "%SaveTo%" == "desktop" goto DT
if "%SaveTo%" == "Docs" goto DC
if "%SaveTo%" == "docs" goto DC
goto NNEEWW
:DT
set Place=DE
:DC
set Place=DO
cls
echo 'Name your file [You can not add the following: \ / : * ? " < > |]'
set /p name="Name: "
echo echo off>>"Current.BAT"
echo cls>>"Current.BAT"
title Editing: %name%.BAT - Program Creator
cls
echo Editing %name%.bat [Type "Quit" to save and quit, Type "Help" to get some help with commands]
echo [@echo off has already been added, to get rid of it, type "echo on", without an @ symbol please]
echo "Please do not add ['>', '|', '<'] as they are not yet supported"
echo.
:2
set /p content="[-]: "
现在每当有人输入&#34; Docs&#34;或&#34;桌面&#34;程序崩溃了!我认为这与set命令有关,但我不确定。
答案 0 :(得分:2)
而不是GOTO使用IF-ELSE结构:
:NNEEWW
CLS
ECHO Where to save the file (Type "Desktop" or "Docs")
SET/P "SaveTo=Where to save: "
IF /I "%SaveTo%" == "Desktop" (
SET "Place=DE"
) ELSE (
IF /I "%SaveTo%" == "Docs" (
SET "Place=DO"
) ELSE (
GOTO :NNEEWW
)
)
CLS
ECHO Name your file…