【发布时间】:2016-01-19 16:52:09
【问题描述】:
我正在尝试编写一个批处理脚本来查找所有目录和子目录,并将它们重命名为单个字母
这是我目前所拥有的
@echo off
SET "alfa=0abcdefghijklmnopqrstuvwxyz"
SET count=1
FOR /D /r %%G in ("*") DO (call :subroutine "%%G")
GOTO :eof
:subroutine
echo %count%:%1
::Get the letter from %alfa% at the index %count%
::Rename the directory %1 to the single char letter retrieved in line above
SET /a count+=1
IF %count%==26 (
SET /a count=1
)
GOTO :eof
文件夹重命名为什么无关紧要,只要它是 a) 只有一个字母 b) 同名的目录不存在于该目录中
注意:一个目录中的目录不应超过 26 个
感谢您的帮助
【问题讨论】:
标签: batch-file