Batch file 简单if语句批处理

Batch file 简单if语句批处理,batch-file,if-statement,Batch File,If Statement,我试着运行代码,但似乎不起作用。如何使代码工作 @echo off SET /P choice= What do you want me to do?: if %choice%==shutdown ( SET /P time= In how many minutes shall I shut down the computer?: set /a "time=%time%*60" shutdown -s -t "%time%" ) elseif ( ) 根据我的评论 @Echo关闭 SetL

我试着运行代码,但似乎不起作用。如何使代码工作

@echo off
SET /P choice= What do you want me to do?:
if %choice%==shutdown (
SET /P time= In how many minutes shall I shut down the computer?: 
set /a "time=%time%*60"
shutdown -s -t "%time%"
) elseif (

)

根据我的评论

@Echo关闭
SetLocal EnableDelayedExpansion
设置/P“选择=你想让我做什么?”
如果/I“%Choice%”为“关机”(
Set/P“Span=我应该在多少分钟内关闭计算机?:”
集/A量程*=60
关闭-S-T!Span!
)其他(如有的话)
)

您应该延迟块内的扩展。您也不应该真正更改系统环境变量的值。什么是
elseif
,这个空分支的意义是什么??