How it works...

PowerShell is not an application that runs on top of Bash. PowerShell is a shell itself. However, it can be called from with Bash just like another application. Like applications, the pwsh command takes in arguments, which are then processed by PowerShell.

The two main ways we may want to use PowerShell from within Bash is to run a single command, or call a script file. You can even call a script block, however, this must be done from within PowerShell. In most cases, running single cmdlets or calling a script should suffice.

In general, when calling pwsh with cmdlets, make -Command (or -c) the last parameter, since anything that comes after the cmdlet itself is considered cmdlet arguments. Same goes for -File as well.

When a script is designed to accept arguments, the script arguments can be passed after the script name, just like with cmdlets.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.117.109