0

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 :)

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, it is working. I'll accept it as a good answer in ~3 minutes. You saved me some hours :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.