我正在制作自己的自定义命令提示符,以便更轻松地完成任务。我已经成功创建了界面和type
命令,但是当我尝试添加help
命令时,它回显了菜单,但是我pause >nul
我放入了@echo off
:HELLO
echo Hello!
pause >nul
cls
echo What can I do for you? Type in your commmand! (Type "help" to display a list of every command available.)
set /p command=
if %command%==type (
goto :TYPEFILENAME
)
if %command%==help (
goto :HELPLIST
)
:MAIN
cls
echo What can I do for you? Type in your commmand! (Type "help" to display a list of every command available.)
set /p command=
if %command%==type (
goto :TYPEFILENAME
)
if %command%==help (
goto :HELPLIST
)
pause >nul
:HELPLIST
echo ----------------------------------
echo Help: Page 1/1
echo Command | What it does
echo help | displays this page
echo type | types a file
echo ----------------------------------
pause >nul
goto :MAIN
。工作,窗口关闭。你能看看,帮帮我吗?
提前谢谢!
ran_list = createList()
如果您需要剩下的代码,请告诉我!这是我认为最重要的,所以我没有添加其余部分。
答案 0 :(得分:0)
帮助部分崩溃的原因是条形(|)字符。 当你想像这样回声特殊时,你必须在它们前面添加一个转义字符(^)。 你的代码部分应该是这样的:
echo ----------------------------------
echo Help: Page 1/1
echo Command ^| What it does
echo help ^| displays this page
echo type ^| types a file
echo ----------------------------------