不清楚你的实际文件/情况,仅以问题中的说明及猜测为据;以下代码复制粘贴到记事本,另存为xx
.bat,编码选ANSI,跟要处理多个
文件夹放一起双击运行<# :
cls&echo off&cd /d "%~dp0"&mode con lines=5000
rem 将当前目录里的多个子文件夹按照递增的数字序号重命名
set #=Any question&set _=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%_% %z%
powershell -NoProfile -ExecutionPolicy bypass "[IO.File]::ReadAllText(\"%~f0\",[Text.Encoding]::GetEncoding('GB2312'))|Invoke-Expression"
echo;%#% +%$%%$%/%_% %z%
pause
exit
#>
$codes=@'
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
public static class ExpDir
{
[DllImport("Shlwapi.dll", CharSet=CharSet.Unicode)]
public static extern int StrCmpLogicalW(string p1, string p2);
public static string[] Sort(string[] f)
{
Array.Sort(f, StrCmpLogicalW);
return f;
}
}
'@;
Add-Type -TypeDefinition $codes;
$b=[Convert]::FromBase64String("IC0tPiA=");
$c=[Text.Encoding]::Default.GetString($b);
$folders=@(dir -literal "."|?{$_ -is [System.IO.DirectoryInfo]}|%{$_.Name});
if($folders.length -ge 1){
$arr=[ExpDir]::Sort($folders);
for($i=0;$i -lt $arr.count;$i++){
$arr[$i]+$c+($i+1).ToString();
}
}