windowspowershellcmdsymlinkshortcut-file

How to follow a symbolic/soft link in cmd or PowerShell?


My searches have only shown me how to create symbolic links using mklink in cmd. I have seen some things saying to use readlink, but PowerShell and cmd don't know what readlink is, and cd obviously doesn't work. So how do I follow one?


Solution

  • For your question i made this batch file:

    mkdir truedir
    dir > truedir\fileone.txt
    mklink /d symdir truedir
    cd symdir
    dir
    

    And i have found no problem to get the content of the symblic link to a directory from command prompt. No problem also with powershell 5.1 (win 10):

    Get-ChildItem C:\Users\<user>\OneDrive\Desktop\test2\symdir
    

    Can you give us a code example (batch or powershell is the same) to replicate your problem?