【问题标题】:Cannot find bug in simple .CMD file在简单的 .CMD 文件中找不到错误
【发布时间】:2015-01-30 00:26:52
【问题描述】:

set /p sum=give nr %amount%: 关闭后,我找不到我的错误。 有人知道为什么吗? 无论如何谢谢;-)

    ::Made By QluPreX 29/01/2015
@echo off
cls
color a
:SET_NUM
    set /p tot=how many numbers:
    cls
    set amount=1    
    set sum_tot=0
    echo %tot%?
    set /p y_or_n=is that correct (y/n) ? :
    if  %y_or_n%==y (
        cls
        goto:GIVE_NUM
    ) ELSE (
        cls
        goto:SET_NUM
    )
:GIVE_NUM
    set /p sum=give nr %amount%:
    set /a sum_tot=%sum_tot%+%sum%
    set /a amount=%amount%+1
    if /I %amount%==%tot%(
        goto:DISPLAY
    )ELSE(
        goto:GIVE_NUM
    )
:DISPLAY
    echo total is %sum_tot%
    pause 

【问题讨论】:

    标签: windows debugging batch-file command-line cmd


    【解决方案1】:

    不知道set /p sum=give nr %amount%:是什么意思

    但是

    )ELSE(
    

    必须

    ) ELSE (
    

    (需要空格)

    同样,

    if /I %amount%==%tot%(
    

    必须

    if /I %amount%==%tot% (
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-30
      • 2016-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-31
      相关资源
      最近更新 更多