Skip to content

Instantly share code, notes, and snippets.

@nohwnd
Created November 20, 2018 17:52
Show Gist options
  • Select an option

  • Save nohwnd/b6cdb8901c1617824bb0e45734538f5b to your computer and use it in GitHub Desktop.

Select an option

Save nohwnd/b6cdb8901c1617824bb0e45734538f5b to your computer and use it in GitHub Desktop.
Rename file with scriptblock for newname
"a" | Set-Content "c:\temp\abc.txt" -Force
Remove-Item "c:\temp\bbc.txt"
Get-Item "C:\temp\abc.txt" |
Rename-Item -NewName { $_.Name -replace "a","b"}
Get-Content "c:\temp\bbc.txt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment