使用批处理文件运行python文件

使用批处理文件运行python文件,python,windows,batch-file,Python,Windows,Batch File,我在批处理文件中有一个“较小”的问题。我从批处理文件中调用Python“miniprogram”,如下所示 mybat.bat: 对于(*.oldextension)中的%%f,执行(C:\Python27\python.exe myPython.py-i“%%f”-o“%%f.newextension”) 它工作正常,但我只想将-o(output)文件名重命名/更改为新的扩展名,并删除旧的扩展名。 那么让我们说 file.oldextension-->file.newextension,因

我在批处理文件中有一个“较小”的问题。我从批处理文件中调用Python“miniprogram”,如下所示 mybat.bat:

对于(*.oldextension)中的%%f,执行(C:\Python27\python.exe myPython.py-i“%%f”-o“%%f.newextension”)

它工作正常,但我只想将-o(output)文件名重命名/更改为新的扩展名,并删除旧的扩展名。 那么让我们说 file.oldextension-->file.newextension,因为现在它看起来像file.oldextension-->file.oldextension.newextension

谢谢你的帮助:)


其中,
%%~nf
%%f

引用的文件名。谢谢,它正在工作。我会在3分钟内接受这个好答案。你帮我省了几个小时:)
FOR %%f IN (*.oldextension) DO (
    C:\Python27\python.exe myPython.py -i "%%f" -o "%%~nf.newextension"
)