How to Delete/Rename files with Path Too Long

The maximum length of a path according to the Windows API, is defined as 260 characters. A subset of Win32 APIs allow you to work around the MAX_PATH restriction by adding the “\?\” prefix. This support up to 32K characters in length but application support is also required (File Explorer do not support it :-))

Windows 10 AU add a “Win32 long Path Support” but not enabled by default and Powershell has finally built-in support for that.

As workaround you can try to use short filename notation:

cmd /c for %A in ("C:\Documents and Settings\User\NTUSER.DAT") do @echo %~sA

or use subst to map a drive letter to a folder:

subst x: "C:\Very long directory\that exceed\length limit\"

To remove the temporary drive letter:

subst x: /d

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s