emacs lisp, cmd.exe, PowerShell, pwsh, complexities


works in cmd.exe and PowerShell
Explorer /select,c:\Users\xah\xtest.txt
Explorer /select, c:\Users\xah\xtest.txt
Explorer /select,"c:\Users\xah\xtest.txt"
Explorer "/select","c:\Users\xah\xtest.txt"

slash no work. open the wrong dir , both cmd and PowerShell
Explorer "/select","c:/Users/xah/xtest.txt"
Explorer "/select", c:/Users/xah/xtest.txt
Explorer /select, c:/Users/xah/xtest.txt

single quote, works in PowerShell, wrong dir in cmd
Explorer /select,'c:\Users\xah\xtest.txt'

space instead of comma, no work. wrong dir
Explorer /select "c:\Users\xah\xtest.txt"

works in PowerShell
Start-Process -FilePath "Explorer.exe"

works in PowerShell
Start-Process -FilePath "Explorer.exe" -ArgumentList "/select,c:\Users\xah\xtest.txt"

works in PowerShell
Invoke-Expression "explorer /select,c:\Users\xah\xtest.txt"

using string array. wrong directory.
Start-Process -FilePath "Explorer.exe" -ArgumentList "/select","c:\Users\xah\xtest.txt"

works in PowerShell , no in cmd
pwsh -Command {Start-Process -FilePath "Explorer.exe" -ArgumentList "/select,c:\Users\xah\xtest.txt"}

works in PowerShell
PowerShell -Command {Start-Process -FilePath "Explorer.exe" -ArgumentList "/select,c:\Users\xah\xtest.txt"}

wrong dir
PowerShell -Command Start-Process -FilePath "Explorer.exe" -ArgumentList "/select,c:\Users\xah\xtest.txt"

syn error
PowerShell -Command Start-Process -FilePath "Explorer.exe" -ArgumentList "/select c:\Users\xah\xtest.txt"

wrong dir
PowerShell -Command Start-Process -FilePath "Explorer.exe" -ArgumentList "/select","c:\Users\xah\xtest.txt"
PowerShell -Command Start-Process -FilePath "Explorer.exe" -ArgumentList "select","c:\Users\xah\xtest.txt"

syntax error
PowerShell -Command Start-Process -FilePath "Explorer.exe" -ArgumentList "/select" "c:\Users\xah\xtest.txt"

this works, but not open the correct dir
pwsh -Command Start-Process explorer -WorkingDirectory c:/Users/xah/web/ergoemacs_org/emacs/i/

find ways to open explorer.exe with file highlighted

xplorer [/n] [/e] [(,)/root,<object>] [/select,<object>]

/n                Opens a new single-pane window for the default
                  selection. This is usually the root of the drive Windows
                   is installed on. If the window is already open, a
                  duplicate opens.

/e                Opens Windows Explorer in its default view.

/root,<object>    Opens a window view of the specified object.

/select,<object>  Opens a window view with the specified folder, file or
                  application selected.

Examples:

   Example 1:
Explorer /select,C:\TestDir\TestApp.exe

      Opens a window view with TestApp selected.

   Example 2:
Explorer /e,/root,C:\TestDir\TestApp.exe

      This opens
Explorer with C: expanded and TestApp selected.

   Example 3:
Explorer /root,\\TestSvr\TestShare

      Opens a window view of the specified share.

   Example 4:
Explorer /root,\\TestSvr\TestShare,select,TestApp.exe

      Opens a window view of the specified share with TestApp selected.