gpt4 book ai didi

powershell - 从powershell中的文件名中删除字符

转载 作者:行者123 更新时间:2023-12-02 06:20:08 38 4
gpt4 key购买 nike

我是 powershell 的新手,想知道是否有办法从文件名中删除字符。我要删除的字符是一个破折号“-”,有时文件名中有 2 或 3 个破折号。是否可以重命名其中包含破折号的文件?

最佳答案

Get-Item .\some-file-with-hyphens.txt | ForEach-Object {
Rename-Item $_ ($_.Name -replace "-", "")
}

这个问题可能更适合 SuperUser。

关于powershell - 从powershell中的文件名中删除字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12590931/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com