How to fix Error 140 on Windows 11

Windows 11 Troubleshooting Guide: Error 140 – “The System Tried to Join a Drive to a Directory on a Substituted Drive”

Why This Error Happens

Error 140 (ERRORJOINTO_SUBST) occurs when a legacy disk management command—JOIN—attempts to merge a physical drive into a directory path that already exists on a virtual drive created by SUBST. Windows does not allow you to stack a JOIN operation on top of a SUBST substitution because the underlying volume mapping becomes ambiguous to the file system driver. This typically happens in legacy scripts, batch files, or older installer routines that still reference drive-letter substitution logic inherited from DOS-era disk management, which is largely deprecated in Windows 11.

Step-by-Step Resolution Guide

  1. Identify Active Substituted Drives
    Open Command Prompt as Administrator and run:
   subst

This lists all currently active virtual drive mappings (e.g., Z: => C:\Projects).

  1. Remove the Conflicting SUBST Mapping
    If the drive letter referenced by the failing JOIN command matches a listed SUBST entry, remove it:
   subst Z: /D

Replace Z: with the actual drive letter causing the conflict.

  1. Avoid Using JOIN Entirely
    The JOIN command is deprecated and unsupported in Windows 11. Locate the script, batch file, or legacy application invoking JOIN and replace it with modern alternatives such as:
  • Mount Points (via Disk Management or mountvol)

  • Symbolic Links using mklink /D

    Example replacement:

   mklink /D "C:\TargetFolder" "D:\SourceFolder"
  1. Check Registry for Legacy Mount Persistence
    Open regedit and navigate to:
   HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices

Look for orphaned or conflicting drive letter entries related to the SUBST/JOIN paths. Export the key first as a backup, then delete only the specific conflicting entry if identified.

  1. Restart and Re-run the Original Task
    Reboot the system to clear any cached drive mapping states, then re-attempt the operation that triggered Error 140.

Alternative or Verification Steps

  • Verify the Fix: Run subst again to confirm no lingering virtual drives exist at the target path, then re-run the original script or installer to confirm Error 140 no longer appears.
  • Alternative Fix: If the issue persists, use Disk Management (diskmgmt.msc) to manually reassign or remove drive letter mappings instead of relying on command-line JOIN/SUBST utilities entirely.