How can I bulk rename files in PowerShell?

前端 未结 8 2117
春和景丽
春和景丽 2021-01-30 10:36

I\'m trying to do the following:

Rename-Item c:\\misc\\*.xml *.tmp

I basically want to change the extension on every files within a directory t

8条回答
  •  时光取名叫无心
    2021-01-30 11:01

    Here's another variant that will work.

    dir *.xml | Rename-Item -NewName {$_.BaseName + ".tmp"}
    

    $_.BaseName will do the "base" name without the (last) extension.

提交回复
热议问题