Reputation: 189
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 :)
Upvotes: 0
Views: 238
Reputation: 70923
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
Upvotes: 1