Wednesday 18 September 2013

batch file (windows cmd.exe) test if a directory is a link (symlink)

batch file (windows cmd.exe) test if a directory is a link (symlink)

I learned just now that this is a way to test in a batch file if a file is
a link:
dir %filename% | find "<SYMLINK>" && (
do stuff
)
How can I do a similar trick for testing if a directory is a symlink. It
doesn't work to just replace with , because dir %directoryname% lists the
contents of the directory, not the directory itself.
It seems like I need some way to ask dir to tell me about the directory in
the way that it would if I asked in the parent directory. (Like ls -d does
in unix).
Or any other way of testing if a directory is a symlink?
Thanks!

No comments:

Post a Comment