How it works...
In the recipe, Calling a PowerShell cmdlet from outside of PowerShell in Chapter 2, Preparing for Administration using PowerShell, we called a PowerShell script from Bash by first invoking PowerShell and then passing the path to the script as an argument to the pwsh command. The process is very similar in PowerShell as well, as seen in the recipe, Launching and stopping a process. However, in the aforementioned recipes, we call the applications first and then pass the file as an argument. Therefore, we do not rely on file associations.
The Invoke-Item cmdlet relies on the internal file association to open the files. The real use of Invoke-Item is when opening multiple files, whether of the same kind, or different kinds of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access