Getting the Directory of a symbolic link (Not the Target of the Link)

Rick Holt 1 Reputation point

I wish to click on a symbolic link in File Explorer and, using a selection from the Context Menu, pass the full name of the symbolic link to a program. Note that I do not want the target of the symbolic link but the directory and name of the symbolic link itself. Using regedit, I can create a command which is passed a file name: something of the form C:/bin/foo.bat "%1". Unfortunately, foo.bat is only passed the target of the symlink. How can this script learn the original directory of the symlink?

Advanced system utilities to manage, troubleshoot, and diagnose Windows and Linux systems and applications.
1,131 questions
0 comments No comments
{count} votes