你的要求正好和我最近做的批处理文件的功能相仿,我修改了一下,现在可以实现你所要的功能了,现在贴出来给你:(复制下来贴到txt文件中另存为??.bat即可)
@echo off
title +++ TXT^&HideFiles +++
color 9f
goto 00
:11
:: list.txt存放完整位置及扩展名
:: list1.txt存放完整位置及文件名(不包括扩展名)
echo.>d:\list.txt
echo.>d:\list1.txt
::把F:\1111中的文件名及扩展名存放到d:\list.txt中
dir /s /b F:\1111>>d:\list.txt
::从d:\list.txt中过滤出完整位置及文件名(不包括扩展名)并存放到d:\list1.txt
for /f "delims=." %%i in ('type d:\list.txt') do (echo %%~fi>>d:\list1.txt )
::从list1.txt中获取地址作为变量内容,转换为TXT扩展名文件
for /f "delims= " %%i in ('type d:\list.txt') do (ren %%i SHDC%%~nxi )
pause
exit
:00
echo 请确认是否要继续,此操作有可能导致部分文件不可使用。。。
echo.
echo.
pause
goto 11
@echo off&SetLocal EnableDelayedExpansion
For /f "delims=" %%i in ('dir /s /b /a-d "f:\1111\*.*"') do (
Set n=SHDC%%~nxi
Ren "%%i" !n!)
pause