Change the extension of multiple files in Windows with one command

With the windows command “ren” (rename), it’s possible to rename multiple files in a specific way, but it’s not possible to remove the extension of multiple files. I wrote myself a script once that modifies text files in-place but first saves a backup copy to “%filename.bak”. If I want to restore the *.bak files, I need to remove the ending .bak only. This is possible with one command by using the “for” batch command like this:

for %x in (*.bak) do ren "%x" "%~nx"


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: