While cmd.exe can work with UNC paths by using
PUSHD \\UNC\Path, I'm attempting to start cmd or a similar command FROM a UNC path. Here's why:
I'm adding a "Map Network Drive Here" to my suite of context menu tools, like "Start Powershell Here" and "Open Command Prompt Here". They add registry keys to the windows registry, and this works great.
As examples, these open a Command Prompt Here:
"cmd /s /k ""VER && TITLE Command Prompt: %1 && PUSHD ""%1"" "" " (For Right-Clicking Folders, works for UNC paths)
"cmd /s /k ""VER && TITLE Command Prompt: %%%CD%%%"" " (For Right-Clicking backgrounds of directories, does not work for UNC paths)
The command is entered as a registry key DWORD, and this works when right clicking a folder:
"net use * ""%1"" " (For Right-Clicking Folders, works for UNC paths)
"net use * ""%%%CD%%%"" " (For Right-Clicking backgrounds of directories, does not work for UNC paths)
%%%CD%%% is being expanded by cmd.exe, which will not start in a UNC path.
My question is; how do I get the path of the right-clicked 'background of a drive or directory' for both UNC and Windows paths expanded in a registry key for the purposes of passing it to a command?
These will go in
This is an open source project, available on GitHub: https://github.com/Ehryk/ContextMenuTools