There are programs allows us to "View File in Explorer" on a file it opened or is listing (e.g. iTunes). Upon selecting that function, the file explorer is opened to the path containing that file and the corresponding file is highlighted. This is the feature I would like to emulate with PowerShell.
It is simple to open to a directory with PowerShell (i.e. explorer $path
). However, attempting to include a file just opens that file with the associated program (e.g. doing explorer $path/$file
where $file
is a .txt
file will just open $file
in notepad
or whatever program is defined to handle .txt
files).
Can PowerShell open the File Explorer to a specific path AND highlight a specific file?