我希望有人帮助我处理这段代码(如下所示)。我想要的只是新文件名需要是文件第一行的前 32 个字符?
cd c:\test2\test
for /f "delims=" %%i in ('dir /a-d /b *.txt') do (
set nname=
set fname=%%i
for /f "usebackq delims=" %%f in ("%%i") do if not defined nname set "nname=%%f"
setlocal enabledelayedexpansion
set "nname=!nname:~0,40!"
rename "!fname!" "!nname!"
endlocal
)
提前致谢...