Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to find the aliases that correspond to a certain folder (and perhaps its sub-directories, too) using Windows cmd? I've tried searching, but it gives me results related to creating aliases for commands, like in Bash. I'm connecting to Windows Server 2008 R2 from a Windows 7 client.

share|improve this question
2  
By alias, do you mean hard links and/or symlinks? –  Dennis Jul 26 '12 at 15:49
    
I'm mainly looking for symlinks, but both, if that's possible... –  FlyingMolga Jul 26 '12 at 18:57

1 Answer 1

up vote 2 down vote accepted

Symbolic links and directory junctions

With dir, you can list all symlinks and junctions in a specific folder and its subfolders.

If you pipe the result to find, you can filter out any links that do not interest you.

Examples:

  • To find all symlinks and junctions on C: that point to C:\Users, use

    dir C:\ /al /s | find /i "[C:\Users]"
    
  • To find all symlinks and junctions on C: that point to C:\Users or one of its subdirectories, use

    dir C:\ /al /s | find /i "[C:\Users\"
    

Unfortunately, this won't tell where the files are located. grep for Windows gives better results:

Examples:

dir C:\ /al /s | grep -Pi "Directory of|\[C:\\Users\]"
dir C:\ /al /s | grep -i "Directory of\|\[C:\\Users\\\\"

Note that you have to escape the brackets, double the backslashes and quadruple a trailing backslash.

Hard links

Because hard links are directly associated to a file by the file system, it's much easier/faster to find them.

To find all hard links to file, use

fsutil hardlink list file
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.