意外的回声

时间:2013-08-20 17:22:19

标签: batch-file time echo

所以我正在为我的朋友制作一个简单的批量游戏,当它到达这个部分时,它告诉我此时Echo命令是意外的并且关闭我无法弄清楚它有什么问题请帮助

:WTS5
set /p chainboots=<"character\inventory\armor\chain\chainboots.txt"
set /p chaingloves=<"character\inventory\armor\chain\chaingloves.txt"
set /p chainhelm=<"character\inventory\armor\chain\chainhelm.txt"
set /p chainlegging=<"character\inventory\armor\chain\chainleggings.txt"
set /p chaintorso=<"character\inventory\armor\chain\chaintorso.txt"
set /p woodensword=<character\inventory\woodensword.txt
set /p Echainboots=<"character/equiped/armor/chain/chainboots.txt
set /p Echainlegging=<"character/equiped/armor/chain/chainleggings.txt
set /p Echaintorso=<"character/equiped/armor/chain/chaintorso.txt
set /p Echainhelm=<"character/equiped/armor/chain/chainhelm.txt
set /p Echaingloves=<"character/equiped/armor/chain/chaingloves.txt
set /p Ewoodensword=<"character/equiped/hands/woodensword.txt
set /p Ewoodensheild=<"character/equiped/hands/woodenshield.txt
cls
echo.
echo.
echo.
echo Current armor intems in inventory include:
echo %true% >"character/inventory/woodensheild.txt"
set /p woodensheild= <"character\inventory\woodensheild.txt"
if %chainboots%==%true% echo 575 Chain boots
if %chainleggins%==%true% echo 680 Chain leggings  
if %chaintorso%==%true%  echo 902 chain torso
if %chaingloved%==%true%   echo 588 Chain gloves
If %chainhelm%==%true% echo 795 Chain helm
echo.
echo.
echo Current weapons and shelds in inventory include:
If %woodensheild%==%true% echo 841 wooden shield
IF %woodensword%==%true%  echo 426 wooden sword

echo.
echo.
echo Current items in inventory include:
echo.
echo.
echo Type 1 to continue otherwise type item id to equip
echo.
set /p a="Enter Item ID:"
If %a%=575 (
 echo %false% > %chainboots%
 echo %true% > %Echainboots%
 goto WTS5 
) Else IF %a%==680 (
 echo %false% > %chainleggings%
 echo %true% > %Echainleggings%
 goto WTS5
) Else if %a%==902 (
 echo %false% > %chaintorso%
 echo %true% > %Echaintorso%
 goto WTS5
) Else if %a%==588 (
 echo %false% > %changloves%
 echo %true% > %Echaingloves%
 goto WTS5
) Else if %a%==795 (
 echo %false% > %chainhelm%
 echo %true% > %Ehainhelm%
 goto WTS5
) Else if %a%==841 (
 echo %false% > %woodenshield%
 echo %true% > %Ewoodenshield%
 goto WTS5
) Else if %a%==426 (
 echo %false% > %woodensword%
 echo %true% > %Ewoodensword%
 goto WTS5
) Else IF %a%==1 (
 goto WTS6
) Else (
 cls
 echo invalid ID
 pause
 goto WTS5
)

2 个答案:

答案 0 :(得分:0)

将您的if比较用双引号括起来:

If "%woodensheild%"=="%true%" echo 841 wooden shield
IF "%woodensword%"=="%true%"  echo 426 wooden sword

答案 1 :(得分:0)

好的,所以在盯着代码超过2个小时后,我发现了我的问题

 set /p chainlegging=<"character\inventory\armor\chain\chainleggings.txt"

if %chainleggins%==%true% echo 680 Chain leggings

没有拼写相同的