首页 > 解决方案 > 无法弄清楚为什么程序在我的脚本中的某个部分无法运行

问题描述

我正在编写一个小脚本来制作大量文件夹,它会进入计算部分(是的,我知道它效率低下,但我无法让 FOR 循环工作),但在那之后它什么也没做. 我不知道它为什么会这样做,它并没有真正给我足够的信息。我确实知道它正在进入计算部分,但它只是在那之后结束程序。如果解决它,也许我可以修复 FOR 循环?

    @echo off
    :Var
    cls
    set created=0


    :select
    Echo How many folders will there be?(1-100)
    set /p Count=
    if %Count% LSS 1 GOTO Var
    if %Count% GTR 100 GOTO Var
    :2sel
    cls
    Echo There will be %Count% folders!
    Echo.
    Echo How many layers deep will this go?(1-10)
    set /p Layers=
     if %Layers% LSS 1 GOTO 2sel
     if %Layers% GTR 10 GOTO 2sel
    cls
    Echo There will be %Layers% Layers and %Count% Folders.
    Echo.
    Echo Are you sure? 1)Yes  2)No
    set /p choi=
    if %choi% EQU 1 GOTO Calculate
    GOTO Var

    :Calculate
    pause
    cls
    if %Layers% EQU 1(
    set dis= %Count%
    GOTO say
    )
    if %Layers% EQU 2(
    set dis= %Count% * %Count%
    GOTO say
    )
    if %Layers% EQU 3(
    set dis= %Count% * %Count% * %Count%
    GOTO say
    )
    if %Layers% EQU 4(
    set dis= %Count% * %Count% * %Count% * %Count%
    GOTO say
    )
    if %Layers% EQU 5(
    set dis= %Count% * %Count% * %Count% * %Count% * %Count%
    GOTO say
    )
    if %Layers% EQU 6(
    set dis= %Count% * %Count% * %Count% * %Count% * %Count% * %Count%
    GOTO say
    )
    if %Layers% EQU 7(
    set dis= %Count% * %Count% * %Count% * %Count% * %Count% * %Count% * %Count%
    GOTO say
    )
    if %Layers% EQU 8(
    set dis= %Count% * %Count% * %Count% * %Count% * %Count% * %Count% * %Count% * %Count%
    GOTO say
    )
    if %Layers% EQU 9(
    set dis= %Count% * %Count% * %Count% * %Count% * %Count% * %Count% * %Count% * %Count% * %Count%
    GOTO say
    )
    if %Layers% EQU 10(
    set dis= %Count%*%Count%*%Count%*%Count%*%Count%*%Count%*%Count%*%Count%*%Count%*%Count%
    GOTO say
    )
    :say
    Echo You are about to make %dis% files.
    Echo Are you sure? 1)Yes  2)No
    pause>NUL
    set /p choi2=
    if %choi% EQU 2 GOTO Var
    )
    cls
    Echo %made% / %dis%
    pause
    :one

    :two
    :three
    :four
    :five
    :six
    :seven
    :eight
    :nine
    :ten        

标签: batch-filecmd

解决方案


我认为您可以查看此行

回声 你确定吗?1) 是 2) 否

暂停>NUL4

设置 /p choi2=

if %choi% EQU 2 GOTO Var

并放

if %choi 2 % EQU 2 GOTO Var

只是一个猜测。;) 有一个愉快的编程日!


推荐阅读