I have a shortcut to a folder on my Desktop (as I don't store files directly on it). Is it possible to get to the directory the shortcut points to when I am in the desktop on command line?

I would like to know if it's possible in Windows as well as Unix-based OS.

  • In Linux, it depends. There are many types of desktops, and many types of icons you can place on the desktop! A quick test in Windows shows that it doesn't work. Neither cd FolderName nor cd FolderName.lnk do what I want.
    – Mr Lister
    Commented Jun 23, 2015 at 16:54
  • 1
    possible duplicate of How can I parse a .LNK shortcut from the Command Prompt in Windows?
    – Karan
    Commented Jun 25, 2015 at 13:51

3 Answers 3


Yes, this is possible on Windows. You need to make directory symlinks. Try out the following commands as an example:

> cd %userprofile%
> mklink /D OMGDOCUMENTS Documents
> dir

You'll notice that the contents of \OMGDOCUMENTS are the same as \Documents. If you then go back to the parent folder %userprofile% and run the dir command, you'll see that your \OMGDOCUMENTS folder will show up as a symlink.

  • When you do the cd command line, it doesn't work with the created link..
    – nonozor
    Commented Jun 16, 2022 at 8:13

See Windows 7 and cd to symbolic links - long and short, if you have an actual symbolic link, it should work as you'd expect. If you just have a shortcut (*.lnk file), those aren't links and won't do what you're wanting.

As far as Linux goes:

username@hostname ~ $ mkdir /home/username/test     # make new directory
username@hostname ~ $ touch /home/username/test/somefile    # make a file in directory
username@hostname ~ $ cd /tmp   # changing to temp folder
username@hostname /tmp $ ln -s /home/username/test testlink # make a link to the folder made previously
username@hostname /tmp $ ls -la test*   # test to show the link connects to the folder I made
lrwxrwxrwx 1 username username 18 Jun 23 11:49 testlink -> /home/username/test
username@hostname /tmp $ cd testlink    # can we traverse into the link?
username@hostname /tmp/testlink $ ls -la    # testing...
-rw-r--r--  1 username username    0 Jun 23 11:49 somefile  # We can!

So via properties you can see the path that the shortcut.lnk is pointing to and run your command pointing to that path. So to access the path you would type the shortcut name in quotes. such as:


Also refer to the following Stack link: How to Execute ShortCut From Command line in Windows 7

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .