Batch File - Remove Second File Extension

2019-03-09 16:28发布

问题:

Using a batch file is there a way that I can strip off the .deploy extension from all files in a directory.

For example

1.txt.deploy => 1.txt
2.txt.deploy => 2.txt 

etc

回答1:

RENAME *.txt.deploy *.

A more 'fancy' solution:

@ECHO OFF
FOR %%f IN (*.txt.deploy) DO RENAME "%%f" "%%~nf"