The mklink command creates symbolic links in Windows, enabling file or folder redirection.
Create Symbolic Link to a File
Creates a soft link pointing to a target file. Deleting the link doesn't delete the target.
mklink * *
Example:

mklink * C:Logs*
Create Directory Soft Link (Symbolic Link)
Creates a soft link to a target directory using /D. Behaves like a true symlink. Requires elevated privileges for remote targets or different drives.
mklink /D LinkDirName TargetDirectoryPath
Example:
mklink /D Projects D:DevelopmentCurrentProjects
Create Directory Junction (Hard Link)
Creates a hard link (junction) to a target directory using /J. More resilient in some legacy scenarios but typically points only to local directories on the same volume.
mklink /J LinkDirName TargetDirectoryPath
Example:
mklink /J OldData E:ArchiveLegacyData
Create Hard Link to a File
Creates an additional hard link pointing directly to the same data as the target file using /H. All hard links are equivalent; deleting any one doesn't delete data until all links are gone. Target must be on the same volume.

mklink /H * *
Example:
mklink /H * C:App*
Key Considerations
- Elevated Command Prompt: Creating directory symlinks (/D) pointing to a different drive or a network location typically requires running Command Prompt as Administrator.
- Absolute Paths Recommended: Always use absolute paths for the
Target
to ensure reliability. - Directory Links: Use /D for directory symlinks (most common), /J for directory junctions (hard links).
- File Links: Use the command without a switch for a file symlink (soft link), or /H for a file hard link.
- Volume Restrictions: Hard links (/H for files, inherently /J for directories) must reside on the same volume (drive) as their target. Soft links (/D) generally do not.