"WARNING - cannot open" during multi-file search
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
"WARNING - cannot open" during multi-file search
I just installed version 7 on Windows 7 64 and noticed this new error "WARNING - cannot open" during large searches.
I received the same number of results as with version 5,
so I assume this is a problem perhaps in the Windows kernel.
Is the limitation 256 bytes of pathname, and is there any workaround to allow it to search very long pathnames ?
When a text editor fails to find a match in a multi-file search,
that is a serious failure of the program, and the developers
should do everything possible to rectify such a bug.
I received the same number of results as with version 5,
so I assume this is a problem perhaps in the Windows kernel.
Is the limitation 256 bytes of pathname, and is there any workaround to allow it to search very long pathnames ?
When a text editor fails to find a match in a multi-file search,
that is a serious failure of the program, and the developers
should do everything possible to rectify such a bug.
-
- Posts: 12
- Joined: Tue Mar 31, 2020 5:33 pm
Re: "WARNING - cannot open" during multi-file search
I am getting this error for it looks like every file that was searched in the folder that was chosen to search.
textpad 8.22.1C:\Users\jschw\OneDrive\Documents\~word documents\sleep images.docx: WARNING - cannot open
Last edited by AmigoJack on Thu Aug 14, 2025 10:59 am, edited 1 time in total.
Reason: quote formatting; typo
Reason: quote formatting; typo
Re: "WARNING - cannot open" during multi-file search
Docx files are not plain text, so TextPad is unlikely to find text strings in them. However, that should not prevent it from opening them. MS Word keeps locked any files it has open, so could that be the cause?
https://www.tenforums.com/tutorials/131 ... ndows.html
Symbolic links can be used to create a shorter path to files. This article explains how to create them:is there any workaround to allow it to search very long pathnames ?
https://www.tenforums.com/tutorials/131 ... ndows.html
Re: "WARNING - cannot open" during multi-file search
Actually programs can work with up to 32.767 character long paths/filenames for decades already: one has to use the "Wide" version of a Win32 API function (f.e. FindFirstFileW()) and then prepend paths/filenames with a 4 character prefix:bbadmin wrote: Thu Aug 14, 2025 10:03 amSymbolic links can be used to create a shorter path to filesAeneas wrote: is there any workaround to allow it to search very long pathnames ?
I'm using this for decades in my programs and never had any problems with it. Unlike Windows' File Explorer, which isn't able to go beyond MAX_PATH (260) characters, too. Which is a terrible restriction on what NTFS is capable of.By default, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, prepend "\\?\" to the path.
Re: "WARNING - cannot open" during multi-file search
The problem is that TextPad uses Windows Explorer for its Open File dialog box, so internally it uses the same MAX_PATH character limitation.
Re: "WARNING - cannot open" during multi-file search
That
- is virtually the only bottleneck/edge case - one could still open files in many other ways where no MAX_PATH limit is imposed:
- program parameter,
- drag'n'drop from anywhere (not just Explorer),
- using short filenames on every folder and the filename itself to cut down character count...
- has nothing to do with the issue here - when recursively searching for/in files the starting directory may still be within the MAX_PATH limit, but files beyond that may exceed 260 characters in full. But when searching in files the "open" dialog is not even involved - neither when TextPad would read a file, nor when the user double clicks/presses ENTER on a match in the search results.
Re: "WARNING - cannot open" during multi-file search
TextPad uses a Microsoft API that passes filenames around in arrays of size MAX_PATH and explicitly rejects any that are longer to prevent buffer overflows. Find in Files has no such limitation but is stymied by that API.
I understand the frustration, but as this thread was started in 2014, and only one person has complained here since, it can't be affecting many users. (You actually have to manually set a value in the registry before you can use long file names, and then they have to be prefixed with "\\?\" for some bizarre reason.) However, now that it's been brought to our attention again, we'll investigate solutions.
I understand the frustration, but as this thread was started in 2014, and only one person has complained here since, it can't be affecting many users. (You actually have to manually set a value in the registry before you can use long file names, and then they have to be prefixed with "\\?\" for some bizarre reason.) However, now that it's been brought to our attention again, we'll investigate solutions.
Re: "WARNING - cannot open" during multi-file search
No: this is only possible since some version of Windows 10 or younger. Older systems don't even have that Registry setting available.bbadmin wrote: Thu Aug 14, 2025 7:14 pm(You actually have to manually set a value in the registry before you can use long file names
But it can still easily happen to have a path that is just about below the MAX_PATH limit and then move either
- files with long filenames or
- whole folders with sub folders
Which is only possible for all the "Wide" versions of the API functions. The reason is not that bizarre, because the Native API functions (not available to the programmer in normal ways) which are then used by the WinAPI itself have this filename syntax by default and it also evades any automatic Explorer-like modifications to the given filename (such as casing and not allowing trailing dots).
If you want, I can give you a small self-compiled program that creates such unreachable folders/files for you, and being able to browse all files beyond the MAX_PATH limit easily (to then delete such files/folders again). It then is also able to create files with names that wouldn't be allowed in all the Explorer-limited ways, too (like having leading spaces in a filename).
Thanks for considering this for future TextPad versions.
Re: "WARNING - cannot open" during multi-file search
You've made a great case for using Linux! 

Re: "WARNING - cannot open" during multi-file search
You can also reduce path lengths by creating a "drive" for your files.
Include the following in the startup script:
That way, long file paths such as:
become much shorter:
This also has the advantage of isolating your scripts and utilities from needing to be changed when you evolve from using OneDrive to some other cloud storage system or adopt a local external drive for your files.
Include the following in the startup script:
Code: Select all
subst J: C:\Users\jschw\OneDrive\Documents
Code: Select all
C:\Users\jschw\OneDrive\Documents\~word documents\sleep images.docx
Code: Select all
J:\~word documents\sleep images.docx
Last edited by AmigoJack on Mon Aug 18, 2025 2:09 pm, edited 1 time in total.
Reason: formatting code as code; correct product name
Reason: formatting code as code; correct product name
Re: "WARNING - cannot open" during multi-file search
One could also create junction/reparse points which are permanent to the file system and don't need a spare drive letter. But it's a shotgun workaround, too (just like a substitution drive), since you need to know beforehand where paths get too long.