Powershell basics

Batch operations for file objects. Rename multiple files: Get-ChildItem *.txt | Rename-Item -NewName { $_.Name -replace ‘.txt’,’.log’ } The Get-ChildItem cmdlet gets all the files in the current folder that have a .txt file extension then pipes them to Rename-Item. The value of NewName is a script block that runs before the value is submitted to the NewName parameter. In the script block, the $_ automatic … Read more