Skip to content

Instantly share code, notes, and snippets.

@sk22
Created November 6, 2020 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sk22/451acdd19ca4902d49b3a2095f0e3439 to your computer and use it in GitHub Desktop.
Save sk22/451acdd19ca4902d49b3a2095f0e3439 to your computer and use it in GitHub Desktop.
learning powershell. syntax weird much hence cheat sheet
'hello', 'aaaaa', 'eeeee'
| % { $_ -replace 'e', 'a' }
| % { $_ -replace 'hallo', 'oida' }
| ? { $_ -like '*a*' }
# equivalent to
@('hello', 'aaaaa', 'eeeee')
| ForEach-Object { $PSItem -replace 'e', 'a' }
| ForEach-Object { $PSItem -replace 'hallo', 'oida' }
| Where-Object { $PSItem -like '*a*' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment