CrLf 当前离线
论坛巡查
TOP
@dir /s /a-d /b *.txt | sed "s/.*\[\([0-9][0-9]\)\][^\\]*/ren \"^&\" \"\1.txt\"/;ta;d;:a" | cmd复制代码
@dir /s /a-d /b *.txt | gawk -F "\\" "{q=\"\x22\";if(match($NF,\"\\[[0-9]{2}\\]\",a))system(\"cmd /c ren\",q $NF q,q substr(a[0],2,2) \".txt\" q)}"复制代码
(Get-ChildItem -Recurse *.txt) -Match "\[\d\d\]" | Rename-Item -NewName {$_.name -replace '.*\[(\d\d)\].*','$1.txt'}复制代码
@set @n=0;/* & echo off if "%~1" == "" echo,请拖拽文件夹&pause&exit if not exist "%~1\" echo,请拖拽文件夹&pause&exit pushd "%~1\" for /f "delims=" %%a in ('dir/b/s *.txt^|findstr "\[[0-9][0-9]\][^\\]*$"^|cscript -nologo -e:jscript %0')do ( Ren %%a 2>nul ) pause & exit/b */ var text = WScript.StdIn.ReadAll().replace(/\r|\n$/g,'') WScript.Echo(text.replace(/^(.*?[^\\]*\[(\d{2})\][^\\]*)$/gm, '"$1" "$2.txt"'))复制代码
(包含子文件夹)