A .exe file found by some instances of PowerShell and not others got me questioning what is the difference between:
Starting PowerShell in a folder from the explorer context menu that appears on "shift + right click". (In my case, the file is not found by this shell)
Starting PowerShell from the context menu that appears when right clicking the lower left corner of the desktop. (In my case, the file is found by this shell)
Details:
Windows 10 Pro, 64 bit. Version 1709, Build 16299.431
When starting from the explorer context window:
The window title is "Windows PowerShell" and the terminal reads "PS" followed by a space and the path to the current folder.
$PSVersionTable.PSVersion returns Major 5 , Minor 1 , Build 16299, Revision 431
When starting it from the desktop, the only difference with starting it from explorer is that "Windows PowerShell" and the copyright information is shown before the terminal line.
.\file.exe
instead of justfile.exe
[System.IO.FileInfo]::new($theFile)
where$theFile
is the full path to your file? What is the output of[System.Environment]::Is64BitProcess
?