Click here to Skip to main content
15,888,293 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
i want to rename single file specific extension "*msi" to replace current version with
another version


for example file name is "test_1.2.6.msi"

want to be renamed using variable i specified


if i entered 2.3.9 as new version file should be renamed to "test_2.3.9.msi"

here is my code i need lettle help

@Echo off
setlocal enabledelayedexpansion
set /p new="New Version: "

for /R %%u in (*.msi) do (
  set "Name=%%~nxu"
  ECHO ren "%%~u" "!Name:_=_%new%!"
)
pause


What I have tried:

i tried to replace underscrore and numbers with current version but not worked for me
Posted
Updated 22-Feb-17 18:27pm

1 solution

Here is a resource that will help you: Top 10 DOS Batch tips [^] - see tip 9

This Command Reference[^] will come in handy too. :)
 
Share this answer
 
v2
Comments
Karthik_Mahalingam 23-Feb-17 12:21pm    
5
TheSniper105 21-Sep-17 0:25am    
thank you but this is so old
Graeme_Grant 21-Sep-17 0:29am    
so are batch files ;)
TheSniper105 21-Sep-17 0:30am    
but you did not answer the question i already visit the above links before
Graeme_Grant 21-Sep-17 0:45am    
yes, look at the dates ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900