Lets take a look at Invoke-Expression's help file by running the command help Invoke-Expression -full I prefer to run the cmdlet Help instead of the full cmdlet Get-Help because help will only show you a page at a time, so by default typing help is the equivalent to Get-Help command | more
PS [www.matthewkerfoot.com]> help Invoke-Expression -full
NAME
Invoke-Expression
SYNOPSIS
Runs commands or expressions on the local computer.
SYNTAX
Invoke-Expression [-Command] []
DESCRIPTION
The Invoke-Expression cmdlet evaluates or runs a specified string as a command and returns the results of the
expression or command. Without Invoke-Expression, a string submitted at the command line would be returned
(echoed) unchanged.
PARAMETERS
-Command
Specifies the command or expression to run. Type the command or expression or enter a variable that
contains the command or expression. The Command parameter is required.
In order to open an .HTML file from PowerShell you must first know the location of the file, then simply type, "Invoke-Expression .\filename.html"PS [www.matthewkerfoot.com]> Invoke-Expression C:\Users\mkerfoot\Desktop\HTML_report.htmlInvoke-Expression can also be used to open an image or any filepath applicable.
PS [www.matthewkerfoot.com]> Invoke-Expression C:\Users\mkerfoot\Desktop\Icon.PNGThe Following command will open up the file I specified in your default browser.