such as: ren "%systemroot%\system32\shell32.dll" "shell32.dll.OLD"
and if that exsist then Go To next such as OLD2 or OLD3 etc.
Any ideas on how to do this?
Thanks for any help..

Moderator: DosItHelp
Code: Select all
@echo off &setlocal
set "Xpath=%systemroot%\system32\"
set "Xname=shell32.dll"
set "Xext=.old"
:: check if the origin file exists
if not exist "%Xpath%%Xname%" goto :EOF
:: look for extension .old
if not exist "%Xpath%%Xname%%Xext%" (
set "Newext=%Xext%"
goto REN
)
:: look for extension .old2 etc.
set /a n=1
:LOOP
set /a n+=1
if not exist "%Xpath%%Xname%%Xext%%n%" (
set "Newext=%Xext%%n%"
goto REN
)
goto LOOP
:: rename the file
:REN
ren "%Xpath%%Xname%" "%Xname%%Newext%"