I wanted to write this as a comment but I do not have 50 reputation.
All of the answers in this thread are essentially to use Invoke-Item or to use explorer.exe directly; however, this isn’t completely synonymous with “open containing folder”, so in terms of opening an Explorer window as the question states, if we wanted to apply the answer to a particular file the question still hasn’t really been answered.
Invoke-Item C:\Users\Foo\bar.txt explorer.exe C:\Users\Foo\bar.html
^ those two commands would result in Notepad.exe or Firefox.exe being invoked on the two files respectively, not an explorer.exe window on C:\Users\Foo\ (the containing directory).
Whereas if one was issuing this command from powershell, this would be no big deal (less typing anyway), if one is scripting and needs to “open containing folder” on a variable, it becomes a matter of string matching to extract the directory from the full path to the file.
Is there no simple command “Open-Containing-Folder” such that a variable could be substituted?
$foo = "C:\Users\Foo\foo.txt" [some code] $fooPath # opens C:\Users\Foo\ and not the default program for .txt file extension