我的批处理脚本工作正常,直到我尝试添加一些long if语句。 林新来这个,并希望如果有人可以检查什么是错的。我试图根据你是什么级别做一个定价计算器。批处理脚本无法获取If语句工作
继承人它是不工作的部分。
if "%drating%" < "1500" (set /a price=%price%+3)
else if "%drating%" < "2000" (@set /a price=%price%+5)
else if "%drating%" < "2500" (@set /a price=%price%+6)
else if "%drating%" < "2700" (@set /a price=%price%+8)
else if "%drating%" < "3000" (@set /a price=%price%+10)
else if "%drating%" < "3300" (@set /a price=%price%+12)
else if "%drating%" < "3500" (@set /a price=%price%+14)
else if "%drating%" < "3800" (@set /a price=%price%+20)
else if "%drating%" < "3900" (@set /a price=%price%+30)
else if "%drating%" < "4000" (@set /a price=%price%+40)
else if "%drating%" < "4100" (@set /a price=%price%+50)
else (
echo There is no available price for %drating%.
echo Press any key to exit.
set /p exitkey=
)
继承人什么我脱线后做
if "%drating%" LSS "1500" (set /a price=%price%+3
) else (if "%drating%" LSS "2000" (set /a price=%price%+5
) else (if "%drating%" LSS "2500" (set /a price=%price%+6
) else (if "%drating%" LSS "2700" (set /a price=%price%+8
) else (if "%drating%" LSS "3000" (set /a price=%price%+10
) else (if "%drating%" LSS "3300" (set /a price=%price%+12
) else (if "%drating%" LSS "3500" (set /a price=%price%+14
) else (if "%drating%" LSS "3800" (set /a price=%price%+20
) else (if "%drating%" LSS "3900" (set /a price=%price%+30
) else (if "%drating%" LSS "4000" (set /a price=%price%+40
) else (if "%drating%" LSS "4100" (set /a price=%price%+50
) else (echo There is no available price for %drating%.
echo Press any key to exit.
set /p exitkey=
exit
)
帮助如果您阅读您尝试使用的命令的帮助。打开一个命令提示符并键入:'if /?' – Squashman
我已经阅读过,不知道我做错了什么,尽管 – Bruce219
真的!您会在帮助文件中看到小于号的符号。 – Squashman