I read an answer on how to separate file name and extensions to rename them...a great answer from Niel, but I can't find the post from my mobile.
I needed some clarification to take it one step further since all my attempts have failed.
So here's the problem. I am attempting to rename multiple files with a DOS batch file.
I receive files like: 999999S.001,999999S.002,etc
What I am attempting to do is rename them as .jpgs but incorporate the original extension.
Like such: 999999S001.jpg
All files will be in the same directory so I assume it will start something similar to for %%f, and I am presuming I can use ~nx1 or ~x1 in the commands, just putting it together is escaping me. Suggestions?
Thank you.
[SOLVED]
I finally worked it out: The following code (probably isn't the cleanest but it works) gives the desired result.
for %%f in (c:\!temp\plots\*.*) do call :renameit "%%f"
goto done
:renameit
SET var1=%~n1
SET var2=%~x1
SET var2=%var2:~1,3%
ren %1 %var1%%var2%.jpg
:done