Answer the question
In order to leave comments, you need to log in
How to write a bat file that only renames part of the filename?
Hello! I ask you to help with one problem that I can not solve due to my poor skills in working with bat-files.
There are several files:
setup.exe
setup-1.bin
setup-2.bin
We need to write a script that will transfer these files to another folder and give them the following names:
setup_ver2.exe
setup_ver2-1.bin
setup_ver2-2.bin
That is, we after "setup" we add "_ver2", the file extension remains the same.
There is such a script:
@echo off
for %%a in (c:\temp\setup*.*) do (
move "%%~a" "<path to the desired folder>\%%~na_ver2%%~xa"
)
but it generates the following set of files: setup_ver2.exe, setup-1_ver2.bin, setup-2_ver2.bin, which doesn't suit me.
Thank you in advance!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question