1.

Solve : DOS Rename batch file for files in different directories?

Answer»

What I need to do is create a simple batch file that I will run from a logon script. I need the batch file to go out and SEEK all the files names consisting of *ADP*DMS*.lnk and RENAME these to ASP.lnk. The files may or may not always be in the same directory. I CREATED the command:
dir /s *ADP*DMS*.lnk ren ASP.lnk
But that just finds all the files, but never renames them.....

Any HELP would be appreciated.try this code

Code: [Select]@echo off
for /f "delims=" %%a in ('dir /s /b "*ADP*DMS*.lnk"') do (
rename "%%~pa%%~nxa" "ASP.lnk"
)That worked PERFECTLY. I can not thank you enough!!!! Thanks.kindly chang %%~pa to this %%~dpa just to insure correctness
so that the code will be
Code: [Select]@echo off
for /f "delims=" %%a in ('dir /s /b "*ADP*DMS*.lnk"') do (
rename "%%~dpa%%~nxa" "ASP.lnk"
)



Discussion

No Comment Found