📜 VBScript (WSH)

Enable Win32 Long Paths (VBScript)

Lifts the legacy 260-character MAX_PATH limit for apps that opt in (requires admin). Requires an elevated (Administrator) prompt. Applies the tweak via WScript.Shell.RegWrite.

By WindowsScripting.com · 750 B
SetEnableLongPaths.vbs
' ============================================================
' SetEnableLongPaths.vbs
'
' Enable Win32 Long Paths.
' Lifts the legacy 260-character MAX_PATH limit for apps that opt in (requires admin). Requires an elevated (Administrator) prompt.
'
' Usage: cscript SetEnableLongPaths.vbs
' ============================================================

Option Explicit

Dim objShell
Set objShell = CreateObject("WScript.Shell")

On Error Resume Next
objShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled", 1, "REG_DWORD"

If Err.Number = 0 Then
    WScript.Echo "Enable Win32 Long Paths applied."
Else
    WScript.Echo "Failed to apply tweak (Error " & Err.Number & ": " & Err.Description & ")"
End If
On Error Goto 0