I have a "smaller" problem in batch file. I'm calling a Python "miniprogram" from batch file like this
mybat.bat:
FOR %%f IN (*.oldextension) DO (C:\Python27\python.exe myPython.py -i "%%f" -o "%%f.newextension")
It is working good, but I want to rename/change the -o(output) filename to a new extension only and remove the old extension. So let's say file.oldextension --> file.newextension, because now it looks like file.oldextension --> file.oldextension.newextension
Thanks for your help :)
asked Sep 9, 2014 at 8:55
Balázs Szántó
1893 silver badges15 bronze badges
1 Answer 1
FOR %%f IN (*.oldextension) DO (
C:\Python27\python.exe myPython.py -i "%%f" -o "%%~nf.newextension"
)
Where %%~nf is the name of the file referenced by %%f
answered Sep 9, 2014 at 9:02
MC ND
71.1k8 gold badges95 silver badges136 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
Balázs Szántó
Thanks, it is working. I'll accept it as a good answer in ~3 minutes. You saved me some hours :)
lang-py