本帖最后由 aloha20200628 于 2024-7-26 11:20 编辑
回复 1# meiszp
以下代码存为 test.bat,置于 *.jpg/*.mp4 等目标文件所在目录中运行...
- @set @x=1 /* &echo off
- for /f "delims=" %%F in ('dir /b/a-d *.jpg *.mp4') do (
- set "a=%%~nF" &setlocal enabledelayedexpansion
- for /f "delims=" %%a in ('cscript /nologo /e:jscript "%~f0" "!a:~-13!" ') do ren "%%F" "%%a%%~xF"
- endlocal
- )
- pause&exit/b */
- v=WSH.arguments, t=new Date(Number(v(0)));
- Y=t.getFullYear(), M=t.getMonth()+1, D=t.getDate();
- h=t.getHours(), m=t.getMinutes(), s=t.getSeconds();
- ts=Y+(('0'+M).slice(-2))+(('0'+D).slice(-2))+'-'+(('0'+h).slice(-2))+(('0'+m).slice(-2))+(('0'+s).slice(-2));
- WSH.echo(ts), WSH.quit();
复制代码
|