How to rename a File via a batch-file but keep the file extention

38 views Asked by At

I have several files like that:

File1.txt
File2.txt
...
FileN.txt

and an executable myExe.exe that takes each one of these files and returns a txt-file with another name but keeps the extention.

( e.g. File1.txt --> File1_out.txt)
( e.g. File2.txt --> File2_out.txt)
( e.g. File3.txt --> File3_out.txt)

I want to run this in a batch-file.

I can add an x at the end of the extention (File1.txt-> File1.txtx ) using the following command :

for /r %%v in (*.txt) do myExe.exe "%%v"  "%%vx"

but I cannot rename the file.

How would I rename the file and keep the extention?

0

There are 0 answers