batch-file - 无法弄清楚为什么程序在我的脚本中的某个部分无法运行
问题描述
我正在编写一个小脚本来制作大量文件夹,它会进入计算部分(是的,我知道它效率低下,但我无法让 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
解决方案
我认为您可以查看此行
回声 你确定吗?1) 是 2) 否
暂停>NUL4
设置 /p choi2=
if %choi% EQU 2 GOTO Var
并放
if %choi 2 % EQU 2 GOTO Var
只是一个猜测。;) 有一个愉快的编程日!
推荐阅读
- python - 在python字典中将键与相同值组合的有效方法
- ruby-on-rails - 在调用期间更改 ActiveRecord 关系对象中的属性
- amazon-web-services - AWS gamelift 车队创建错误:SERVER_PROCESS_TERMINATED_UNHEALTHY
- python-3.x - 如何检查python中是否存在twitter用户名
- prometheus - InfluxDB 查询 PromQL
- postgresql - GraphQL:添加计算字段时出错
- linux - X509Store 在 Linux 上总是空的
- google-bigquery - 范围 Coulmn 上的 OrderBy(类型字符串)数字 BigQuery
- ruby-on-rails - Rails find_or_create_by 使用默认值
- python - 从 PyInstaller 的 hiddenimports 中的 collect_submodules 访问导入模块的列表