Is LaTeX (pdflatex) able to read files with extra long file names on Windows? (up to 32767 unicode characters)


The NTFS file system supports large paths and file names up to 32,767 unicode characters, normally this is restricted by the 260 character* MAX_PATH limit enforced by the Windows Win32 API. This means it is sometimes possible, when moving files and directories around, or mapping drives, to create a pathname which is too long for Win32 to process.

There is an alternative for accessing very long filenames: for file I/O, the "\?\" prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system.


Because it turns off automatic expansion of the path string, the "\?\" prefix also allows the use of ".." and "." in the path names, which can be useful if you are attempting to perform operations on a file with these otherwise reserved relative path specifiers as part of the fully qualified path. This syntax can be used in both CMD and PowerShell.

"\\?\UNC\Server64\Teams\Personnel\some - very - long - file - name.txt"
\input{ \\?\extremly_long_file_name } % Will this work?
  • I found a similar question but I'm not sure if it really answers my question: tex.stackexchange.com/questions/24604/… Aug 26, 2019 at 23:11
  • 2
    Note that you'd need to detokenize or otherwise pass \ , here, plus really you should never have paths in TeX file names: they should be put somewhere 'TeX can find them' and then given by name only.
    – Joseph Wright
    Aug 27, 2019 at 6:34
  • @JosephWright, yes, I agree. Putting full path into latex documents is a bad practise and should be avoided. However the question was just about latex \input behaviour on windows machines. Sep 24, 2019 at 6:03
  • 1
    While the above is correct, it should also be noted that many a piece of code written for non-Unicode (in Windows called "ANSI", which is sort of a misnomer, but whatever) will hardcode the buffer sizes to MAX_PATH, so the paths still won't be accepted. On modern Windows versions (some Windows 10 introduced this, IIRC) it's possible to enable long path names by default (without any prefix), but this still won't affect old code hardcoding buffer sizes to MAX_PATH. Some reading material. Jun 2, 2020 at 14:27

1 Answer 1


I tested it only with paths which have < 260 characters and it seems to work (Texmaker 5.0.3, on Windows 7, 64 bit). One need to replace all backslashes \ to normal slashes /. It works also with NTFS large path syntax: \\?\....

Just change: \\?\C:\\Users\foo\myfile.txt to //?/C:/Users/foo/myfile.txt


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.