I try and work as much as possible from the PowerShell host, as opposed to using the mouse to point and click. One common use case is for me to open different file types.
As with everything in PowerShell, there are several ways to do this.
I could enter the file path as a parameter to the program that opens the file type. A relatively easy example would be to open a text file in Windows Notepad. If I have a file called “hello.txt” in my PWD (Present Working Directory) I could type
This would launch that file in Notepad.
But what if I want to open an Excel file. By default, I CANNOT type
Alas, there is an easy way to open this file. Just type
By the way, I don’t type out the whole file name or even the single quotes around the file name. I just type the first couple letters of the file name and press tab…. PowerShell tabs through all matching files for me. So I would just type
ii is an alias for Invoke-Item. It does not require knowing the name or location of the program that opens any given file type.