powershell - 使用 CMD 或 PowerShell 修剪文件扩展名
问题描述
我想更改的目录中有以下 2 个文件:
a.exe.deploy
⇒ a.exe
b.config.deploy
⇒b.config
我看到了这个的用例ren
,但我不能让它修剪最后一部分。
解决方案
将文件重命名为其基本名称。例子:
Get-Item 'C:\path\to\a.exe.deploy' | Rename-Item -NewName { $_.BaseName }
推荐阅读
- c# - 在 4.5.11 版中忽略了 web.config 或 app.config 中的 NLog 配置
- python - 将 Recaptcha 表单添加到我的 Django 登录页面
- ruby-on-rails - 有谁知道用于 SQL Server 的 Rails 数据库适配器,它使用 ODBC 驱动程序并且也应该在 rails 5.0 上工作?
- java - 如何调用基类方法
- reactjs - 使用 React Context 时避免重复
- javascript - JS树选择未选择的项目
- excel - 创建多个工作表以转储数组数据
- java - 以编程方式实现多个按钮状态而不是单独的按钮
- sql - 如何使用不过滤数据的地方进行预加载
- mysql - 如何让我的产品搜索更有效率?