Enable Long Paths on Windows (Fix 'Path Too Long')

Lift the 260-character path limit by setting LongPathsEnabled=1 in the registry, for deep node_modules or archive trees.

WindowsregistryFilesadminpathMedium risk
In an admin prompt run the reg add command above to set HKLM\...\FileSystem\LongPathsEnabled to 1, then restart Windows.

01Command

Command
$ reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f

02What it does

Legacy Win32 APIs cap paths at 260 characters (MAX_PATH), which is why extracting an archive or deleting node_modules can fail with 'path too long'. Setting LongPathsEnabled to 1 lets long-path-aware applications use paths up to about 32,000 characters; the app must opt in (git config core.longpaths true is git's own switch). Shortcuts like robocopy and the \\?\ prefix work around the limit per-command without touching the registry.

03Risk

RiskMedium risk
RequirementsElevated (admin) prompt; restart required; the application itself must be long-path aware.
!Warning: Registry change requires a restart, and old applications that aren't long-path aware will still fail — this is not a magic fix for every tool.

04Undo

Undo
$ reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 0 /f

05Sources

  • Maximum File Path Limitation
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Documents the 260-character MAX_PATH limit and the LongPathsEnabled registry key that lifts it for long-path-aware apps.

Last verified: 2026-09-18 · Category: Files & Folders

06Related solutions