Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Auto renaming
Name: TerryE Date: July 16, 2009 at 11:38:10 Pacific OS: Windows XP Subcategory: Batch
Comment:
I’m tiring to get a .bat file to rename oeminfo.ini to oeminfoBAK.ini and if it exist to auto rename oeminfoBAK1.ini and so on. if exist c:\windows\system32\oeminfoBAK.ini ren c:\windows\system32\oeminfo.ini oeminfoBAK2.ini and if exist c:\windows\system32\oeminfo.ini ren c:\windows\system32\oeminfo.ini oeminfoBAK.ini works but I know there is a better way. I’m not to good at this and it looks like you all have it mastered, your help would be deeply appreciated.
Name: dtech10 Date: July 20, 2009 at 16:55:56 Pacific
Reply:
Hi Terry Try This
@echo off SetLocal EnableDelayedExpansion
set FPath=c:\windows\system32\oeminfo set Num=0
if exist %FPath%.ini (ren %FPath%.ini oeminfoBAK.ini & exit/b) dir /b %FPath%BAK*.ini | find "oeminfoBAK" > Files.txt
for /f "tokens=1-2 delims=BAK" %%a in (Files.txt) do ( for /f "tokens=1 delims=.ini" %%c in ("%%b") do (set Num=%%c) if !Num! EQU 0 (ren !FPath!BAK.ini oeminfoBAK1.ini) if !Num! GTR 0 ( set /a Num2=!Num!+1 ren !FPath!BAK!Num!.ini oeminfoBAK!Num2!.ini ) ) del Files.txt
Summary: Hi Everyone I’m tiring to make batch file to rename oeminfo.ini to oeminfoBAK.ini and if it exist to auto rename oeminfoBAK1.ini and BAK2 and BAK3 and so on.. I would also like to rename oemlogo.bmp...
Summary: While scanning invoices from our scanner to a catalog on the server the file(s) are saved as: FAKT.PDF FAKT(1).PDF FAKT(2).PDF ... and so on ... My goal is to rename theese files to the real invoice...
Summary: Valerie, Your explanation in terms of the steps was great - It cleared up a few things for me. Ok, I tried the script however still nothing happened. I do see issues regarding steps 2 and 3. Step 3...