So I have created a bunch of symbolic links to top of source code tree, data directories, etc
How do I, from command line, cd to these links?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
Are you sure you actually created symbolic links, or did you create a Windows Shortcut? Those are not links, and don't work as such. Actual symbolic links behave like other directories, so if you are unable to
cd into it, either you a) don't have permissions to enter the target directory, b) the symlink doesn't point to a valid directory, or c) it's actually not a symlink.
(If you want to create NTFS symlinks, use the MKLINK command)
As a parable, imagine a river and its tributaries: all those rivers flow into the large river; that is the directory structure; riverside towns are files. Now, a Windows Shortcut is just a sign on the riverbank: "it's not here, you need to go back down to Mississippi and then up Ohio, it is five miles upstream, on the left bank" - but you need to read English to understand it (have a program which handles this for you, e.g. Explorer.exe). A symlink is like a water canal: if you follow it, it will actually take you someplace else, no matter whether you can read English or not (no matter what program you use).
Example: Target folder is d:\code\ , I made a shortcut (rightclick-drag-drop) to it in C:\
The 'shortcut' is an .lnk file which has the target path (D:\code)and a bunch of other junk in it ie. computer name (kandalf) and god knows what else.
You could parse the .lnk file and use the path inside it.
Google for 'parse .lnk file ' (in C/VB/Whatever you preffer) or '.lnk file format'
Too much trouble? why not use full paths in your config file/whatever it is you're doing? ;)
As a last resort I'd go for NTFS Junctions... Last resort because, the windows file manager is stupid, ie. when you delete a junction it doesn't just delete the junction; it deletes the junction AND the target folder and all it's files! Now think of that junction sitting under a deep directory structure in an obscure folder that you later want to delete -- yup you guessed it!