Updated 13/04/2021
Basic Functions
1 | --- debug |
PowerShell Core is portable as pwsh
- https://github.com/PowerShell/PowerShell
- https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_pwsh
invoke-expression
This will open a new ps window, Read-Host
keeps it open.
1 | invoke-expression 'cmd /c start powershell -Command { write-host "Running stubs!"; set-location ".\stubs\foo\"; docker-compose up ; Read-Host}'; |
You can also pass set-location
an absolute path, this is generally trash but will work in a pinch!
1 | set-location "C:\Dev\foo-app\api\"; |
Argument
foo.ps1 foo bar baz
1 | write-host "There are a total of $($args.count) arguments" |
Named Parameters
foo.ps1 -Reset true -BuildSource true
1 | Param( |
Parameter attribute
Title
1 | $host.ui.RawUI.WindowTitle = ''Sweet Title'' |
Operators
Approved Verbs for PowerShell Commands
Set-Variable
1 | // set |