使用CMD或PowerShell修剪文件扩展名

ben*_*123 -2 powershell cmd

我在目录中有以下2个文件,我想更改:

a.exe.deploya.exe
b.config.deployb.config

我看到ren了这方面的用例,但我不能让它修剪最后一部分.

Ans*_*ers 5

将文件重命名为其基名.例:

Get-Item 'C:\path\to\a.exe.deploy' | Rename-Item -NewName { $_.BaseName }
Run Code Online (Sandbox Code Playgroud)