LinuxCommandLibrary

pwsh

PowerShell Core is a cross-platform automation and configuration tool/framework.

TLDR

Start an interactive shell session

$ pwsh
copy


Start an interactive shell session without loading startup configs
$ pwsh -NoProfile
copy


Execute specific commands
$ pwsh -Command "[echo 'powershell is executed']"
copy


Execute a specific script
$ pwsh -File [path/to/script.ps1]
copy


Start a session with a specific version of PowerShell
$ pwsh -Version [version]
copy


Prevent a shell from exit after running startup commands
$ pwsh -NoExit
copy


Describe the format of data sent to PowerShell
$ pwsh -InputFormat [Text|XML]
copy


Determine how an output from PowerShell is formatted
$ pwsh -OutputFormat [Text|XML]
copy

Copied to clipboard