我想使用一个批处理文件,如果你键入“打招呼”,它会做回声你好

时间:2013-04-06 11:35:51

标签: batch-file cmd echo

这是我的批处理文件:

@echo off

:start

set /p test=">"

if "%test%" == "shutdown" do shutdown

if "%test%" == "say hello" goto echo

:echo

%echo%

goto start

:shutdown

shutdown /s

exit

但我想用用户输入的任何内容替换“hello”,这可以吗?

1 个答案:

答案 0 :(得分:0)

@echo off

:start
set /p test=">"
if "%test%" == "shutdown" goto shutdown

echo you typed: %test%
goto start

:shutdown
shutdown /s
exit