::******************************************************************** :: * :: renlnk.cmd * :: * :: rename "Vernkuepfung mit" - .lnk files * :: * :: author: Norman Krebs, Tu, 16.09.2003 12:48:24 * :: * :: to proceed all files in a directory including * :: all subdirectories type * :: * :: for /r /d %i in (*) do @ren_verkn %i * :: * ::******************************************************************** @echo off setlocal :: change this to fit the script to your language set PATTERN=Verkn?pfung*.lnk :: set DELOLD=n to get a prompt asking you to delete the old files set DELOLD=y for %%i in ("%0") do ( if [%%~xi]==[] ( set BASENAME=%%~nxi.cmd ) else ( set BASENAME=%%~nxi ) ) if _%1_==_?_ ( echo %BASENAME% - rename "Verknuepfung mit .." link files echo Usage: echo %BASENAME% ^ exit /b ) if _%1_==__ ( set TARGET=%CD% ) else ( set TARGET=%* ) if not [%TARGET:~-1%]==[\] set TARGET=%TARGET%\ echo [%TARGET%] if _%DELOLD%_==_n_ ( set /p DELOLD=delete old .lnk files? ([%DELOLD%] y/n/x=exit) ) if _%DELOLD%_==_x_ ( echo exit by user exit /b ) set /a n=0 for %%i in ("%TARGET%%PATTERN%") do ( set DUMMY1=%%~dpi set DUMMY2=%%~nxi copy /Y "%%~dpnxi" "!DUMMY1!!DUMMY2:~16!" >NUL if [%DELOLD%]==[y] del /Q "%%~dpnxi" set /a n+=1 ) echo %n% files renamed endlocal