wslbbdb 当前离线
列兵
Nsqs 当前离线
少尉
@echo off&pushd %~dp0&call set "ext=txt" for /f "delims=" %%1 in ('dir/a-d/b *.%ext%')do for /f "tokens=1-5 delims=:/- " %%2 in ("%%~t1")do ren %%1 %%~n1%%2年%%3月%%4日%%5点%%6分%%~x1复制代码
TOP
CrLf 当前离线
论坛巡查
@dir /b /a-d | hash /g con /do:"echo ren ""%s"" ""%s%s.%s""",file,@name:base,tw:"%Y年%m月%d日%H时%M分",@name:ext复制代码
评分人数
happy886rr 当前离线
等待验证会员
setlocal enabledelayedexpansion&for %%a in (*.txt) do (set "n=%%~na"&set "t=%%~ta"&ren "%%a" "!n:~0,-17!!t:~0,4!年!t:~5,2!月!t:~8,2!日!t:~-5,2!点!t:~-2!分%%~xa")复制代码
WHY 当前离线
上校
dir *.txt | ren -newName { $d = $_.LastWriteTime.ToString('yyyy年MM月dd日HH点mm分'); $_.Name -replace '(\d{4}年\d+月\d+日\d+点\d+分)?(\.txt)$', ($d + '$2') }复制代码
pcl_test 当前离线
荣誉版主
/*&cls @echo off dir /a-d /b *.txt|cscript -nologo -e:jscript "%~f0" pause&exit */ function az(n){return n<10?'0'+n:n;} function FormatDate(str){ var dlm = new Date(str); var y = dlm.getFullYear()+'年'; var M = az(dlm.getMonth()+1)+'月'; var d = az(dlm.getDate())+'日'; var h = az(dlm.getHours())+'时'; var m = az(dlm.getMinutes())+'分'; return y+M+d+h+m; } var fso = new ActiveXObject('Scripting.FileSystemObject'); while(!WSH.StdIn.AtEndOfStream){ var file = fso.GetFile(WSH.StdIn.ReadLine()); var dlm = FormatDate(file.DateLastModified); if(/(\d{4}年\d+月\d+日\d+时\d+分)\.[^\.]+$/.test(file.Name)){ if(RegExp.$1 != dlm){ file.Name = file.Name.replace(/(.+)\d{4}年\d+月\d+日\d+时\d+分(\.[^\.]+)/, '$1'+dlm+'$2'); } }else{ file.Name = file.Name.replace(/(.+)(\.[^\.]+)/, '$1'+dlm+'$2') } } WSH.echo('Done');复制代码