In Windows the default total path length must not exceed 260 characters (drive
+ :\
+ 255 characters of filename
+ null terminator
+ probably for final \
in case the path is a directory or simply for even rounding). It was a relic from DOS's 8.3-name era where a 260-character path is a really deep path.
It's possible that your path to the folder was already very long, so the remaining part for your filename is just 129. If you want longer path, you have several solutions:
Since Windows 10 there's another option by removing MAX_PATH limitation§. You can enable it by setting HKLM\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled
in registry or set Computer Configuration > Administrative Templates > System > Filesystem > Enable NTFS long paths in group policy
Note that folders have a different limit. If you make a new folder in PowerShell or .NET that has very long name you'll get the below error
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
That's because it "allows for 248 characters for the path plus the filename which allows for 12 characters."
MAX_PATH, which limits file paths to a paltry 259 characters (sans the terminating null); the current directory to 258 characters (sans a trailing backslash and null); and the path of a new directory to 247 characters (subtract 12 from 259 to leave space for an 8.3 filename).
The maximum length of the path of a file: 259 or 258 characters?
Read more:
‡The maximum path of 32,767 characters is approximate, because the \\?\
prefix may be expanded to a longer string by the system at run time, and this expansion applies to the total length.
§Starting in Windows 10, version 1607, MAX_PATH
limitations have been removed from common Win32 file and directory functions. However, you must opt-in to the new behavior.