Remove character from file name in powershell

后端 未结 2 694
不思量自难忘°
不思量自难忘° 2020-12-17 05:00

I\'m new to powershell and wanted to know if there\'s a way to remove a character from a file name. The character I\'m trying to remove is a dash \"-\" and sometimes there

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-17 05:41

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

    This question may be more suitable for SuperUser.

提交回复
热议问题