Skip to content

Sym Links

Published: at 06:46 AM

This guide helps in creating and managing symbolic links and custom drive mappings using the subst command and registry modifications in Windows. It also provides examples of labeling drives and removing labels.

Symbolic links (symlinks) are a powerful feature in Windows that allow you to map directories or files to other locations, providing flexibility in file management. Below are some useful commands and configurations for creating and managing symbolic links and drive mappings.

  1. Create a virtual drive using subst
    This command maps a folder to a drive letter.

    subst G: C:\gitroot
    
    • This maps the folder C:\gitroot to the virtual drive G:.
  2. Registry Path for Symlink Drive Mapping (Win10)
    In Windows 10, symbolic drive mappings are stored in the registry. Use the following registry key to manage symbolic drives:

    Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices
    
    • Add a new entry under DOS Devices:
      • Value: G:
      • Data: \??\C:\gitroot

    This ensures that the symbolic link is persistent across system restarts.

    FYI: these registry entries vanish with every major windows update. Maybe keep a batch file with your commands handy.

Personal System Setup

For your own system, you can create multiple symbolic links and drive mappings. Below are examples of such mappings:

  1. Mapping to Specific Folders
    Create symbolic links for various folders by using the subst command:

    subst D: C:\_D
    subst P: D:\_portables
    subst G: D:\_gitroot
    subst I: D:\_apps
    subst V: D:\vsonline
    

    These commands create virtual drives D:, P:, G:, I:, and V: mapping them to specific directories on the D: drive.

  2. Remove a Subst Mapping
    To remove a mapped drive, use the /D flag with the subst command:

    subst I: /D
    

    This removes the mapping for the drive I:.

  3. Labeling Drives
    You can also label drives to make them easier to identify. For example:

    label D: data
    
    • This labels the drive D: with the name data.
  4. Remove Drive Label
    To remove the label of a drive, simply open the drive (e.g., type C:) in Windows Explorer, right-click, and choose Label. You will be prompted to remove the existing label.


Previous Post
Internet Speed
Next Post
Storytelling in Logo Design