Skip to content

Instantly share code, notes, and snippets.

@stevedoyle
Last active July 22, 2021 14:04
Show Gist options
  • Save stevedoyle/9f9fee1a7f76e1d234a17a0748d40be7 to your computer and use it in GitHub Desktop.
Save stevedoyle/9f9fee1a7f76e1d234a17a0748d40be7 to your computer and use it in GitHub Desktop.
Collection of notes for using Power Shell.

PowerShell Notes

Searching/Grepping files

PowerShell equivalent of egrep:

Select-String <string>

and egrep -r:

dir -Recurse | Select-String <string>

Example, search all .h files for the string "text":

dir -Include *.h -Recurse | Select-String text

Renaming multiple files

Example, rename all text files in the current directory to have a .puml extension instead of .txt.

Get-ChildItem -Filter "*.txt" | Rename-Item -NewName {$_.name -replace 'txt','puml' }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment