首页 > 解决方案 > 使用 CMD 或 PowerShell 修剪文件扩展名

问题描述

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

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

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

标签: powershellcmd

解决方案


将文件重命名为其基本名称。例子:

Get-Item 'C:\path\to\a.exe.deploy' | Rename-Item -NewName { $_.BaseName }

推荐阅读