后藤在这个时候批Windows 7的启动意外 [英] Goto was unexpected at this time batch windows 7 starter

查看:178
本文介绍了后藤在这个时候批Windows 7的启动意外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这code被设计成类似口袋妖怪战斗游戏的一个简化版本。我只有在袭击codeD。我一直在测试摸底,发现一个错误信息(后藤在这个时候意外)每当用户证实了他们的进攻。警告!! code是96线长。最后,我把这个问题部分,所以你可以跳过这第一大块。

This code is designed to resemble a simpler version of the Pokemon battle gameplay. I've only coded in the attacks. I've been testing thoroughly, and found that an error message (Goto was unexpected at this time) whenever the user confirmed their attack. WARNING!! Code is 96 lines long. At the end, I'll put the problem section, so you can skip this first huge chunk.

@echo off
Set H1=20
Set A1=8
Set D1=6
Set S1=5
Set H2=14
Set A2=5
Set D2=4
Set S2=8
:Begin
CLS
Echo Bulbasur
Echo %H2%/14      /\       
Echo           (__) ___  
Echo           l __lo.ol 
Echo           l_\ l_\"  
Echo.        
Echo     _ 
Echo *  / \ 
Echo \\l  )
Echo  \\__l   Charmander
Echo             %H1%/20
Echo -Attack -Capture
Echo -Item   -Run 
Set /p Move=Action?
If %move%==Attack goto Attack
If %move%==Catpure goto capture
If %move%==Item goto Item
If %move%==Run Goto Run
Echo I'm sorry, Charmander can't do that. 
Pause
goto Begin
:Attack
ClS
Echo Attacks
Echo 1)Tackle
Echo 2)Growl
Echo 3)Ember
Echo 4)Scratch
Set /p attack=Which one?
If %attack%==Tackle goto Tackle
If %attack%==1 goto Tackle
If %attack%==Growl Goto Growl
If %attack%==2 goto Growl
If %attack%==Ember goto Ember
If %attack%==3 goto Ember
If %attack%==Scratch goto Scratch
If %attack%==4 goto Scratch
If %attack%==Cancel goto Begin
Echo I didn't get that
Goto Attack
:Tackle
CLS
Echo Tackle Hits The opponent where it hurts. EVERYWHERE.
Echo Do you want to?
set /p accept=Yes/No?
If %acccept%==Yes goto Combat
If %acccept%==No goto Begin
Echo I didn't get that.
goto Tackle 
:Growl
CLS
Echo Growl lowers the opponents attack.
Echo Do you want to?
set /p accept=Yes/No?
If %acccept%==Yes goto Status
If %acccept%==No goto Begin
Echo I didn't get that.
goto Growl
:Scratch
CLS
Echo Scratch hits the foe with a claw.
Echo Do you want to?
set /p accept=Yes/No?
If %acccept%==Yes goto Combat
If %acccept%==No goto Begin
Echo I didn't get that.
goto  Scratch
:Ember
CLS
Echo Ember hits the opponent with a small fire.
Echo Do you want to?
set /p accept=Yes/No?
If %acccept%==Yes goto Combat
If %acccept%==No goto Begin
Echo I didn't get that.
goto Ember
:Combat
CLS
If NOT %attack%==Growl If NOT %attack%==2 set /a H2=%H2%-(%A1%^2/%D2%)
set /a H1=%H1%-(%A2%^2/%D1%)
goto Begin
:Status
CLS
Set /a A1=%A1%-1
goto Combat

问题区域:

:Tackle
CLS
Echo Tackle Hits The opponent where it hurts. EVERYWHERE.
Echo Do you want to?
set /p accept=Yes/No?
If %acccept%==Yes goto Combat
If %acccept%==No goto Begin
Echo I didn't get that.
goto Tackle 

在code送过来很好,但一旦我在这里,它并不期望goto的命令。任何人都可以解决这个问题的牛肉? (注:钓具仅仅是一个例子的攻击工作无。)编辑:如果用户将在是,否,胡言乱语,或者什么都没有,它仍然提供了相同的错误消息(转到在这个时候意外)

The code gets here fine, but once I'm here, it doesn't expect the goto commands. Anyone can fix this beef? (Note: Tackle is just an example. None of the attacks work.) If the user puts in "Yes","No",gibberish, or nothing, it still delivers the same error message (goto was unexpected at this time)

推荐答案

您必须把它放在引号:

if "%accept%"=="yes" goto combat
if "%accept%"=="no" goto begin

或者说,如果你不想让它区分大小写的:

Or rather if you dont want to make it case sensitive:

if /i "%accept%"=="yes" goto combat
if /i "%accept%"=="no" goto begin

这篇关于后藤在这个时候批Windows 7的启动意外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆