win32lfn Extension

Allow manipulating long file names on Windows

Author: Aaron Cohen <>


This extension is not distributed with Mercurial


Windows for legacy reasons only supports files with a total path length, including directory separators, such as "/" of 260 (MAX_PATH) characters. This extension uses an alternate API in Windows which allows manipulating working copy files whose path is longer than 260 characters.

This API is a fairly recent addition to Windows, and works ok for the most part, but there are several limitations in Windows itself when it comes to long paths. If you encounter any issues while using this extension, please update the wiki page and/or email the author.



Enable the extension in the appropriate configuration file (mercurial.ini):

win32lfn = C:\path\to\extension\


Since the builtin Windows commands don't support long files very well, this extension provides one new command to assist in working with the repo at the command line.

hg lfn [--clean [--force]]

-c --clean              Prompt to delete long files
-f --force              Delete long files without prompting

With no options given, "hg lfn" will list all files in the working copy longer than 260 characters.


Win32LongFileNamesExtension (last edited 2021-10-26 18:28:29 by cspeck)