Page 1 of 1
Custom buttons and long paths
Posted: 23 Mar 2026 12:34
by niyueru
Hello
If a file path is too long (more than 257 characters), XYplorer cannot read it and pass it to the script. Only 257 characters are being read. Windows is configured to handle long paths.
I'm trying to pass the path using two commands:
openwith """pyw"" ""Y:\Programs\В корзину.pyw""";
run quote("Y:\Programs\В корзину.pyw") . ' ' . quote("<curitem>");
If the file path is less than 257 characters long, the script runs.
Is there a way to fix this, or is there perhaps another solution?
Re: Custom buttons and long paths
Posted: 23 Mar 2026 12:46
by highend
File (full path = 269 characters):
Code: Select all
D:\Temp\Overlong path. Dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure proident\test.txt
Entry for the button:
Code: Select all
openwith """notepad"" ""<curitem>""";
Notepad opens the file just fine when executed?
Re: Custom buttons and long paths
Posted: 23 Mar 2026 13:19
by niyueru
259 characters - yes
more than 259 - no (The system cannot find the specified path.)
Re: Custom buttons and long paths
Posted: 23 Mar 2026 17:13
by Raf
I can suggest use intermediate layer like
AutoHotkey:
- Download v2.
- Install and make sure that file assoc. was updated.
- Create
Run.ahk anywhere:
Code: Select all
#Requires Autohotkey v2
Run('path to runner pyw "' A_Args[1] '"')
- Find a open
ahk2exe.
- Compile this file using 2.0.xx AHK version.
- Replace Xyplorer button command with
Re: Custom buttons and long paths
Posted: 23 Mar 2026 18:35
by niyueru
Hmm... It's a bit odd to run a script through another script, but I'll give it a try =)
upd:
If the folder path exceeds 256 characters, the custom buttons simply stop working. It doesn't matter whether they read the file path or simply launch something.
For those who are interested, here is an example of a folder path:
A:\- Клиенты\- АД\- инфраструктура\test\453м6754тг7 64шш878т5л 84л8 ль87ь 58ь7ь7585о5 578л587л\Новая папка8tcy95ytb9y592v8y92 882ug984928 b59bh98hb u24b98tunb89746h2nb743hnb7g45hb46b\9483yghiu4 hg95yghu4hb9864hbnu5b9 bu hn98 5n 89hh 24gh98trhbvjrtb9 h 498uh bnr 54gh4uhg 9hu
The screenshot shows 256 characters in the path in the bottom line. This all seems to be related to the length of the path...
A:\- Клиенты\- АД\- инфраструктура\test\453м6754тг7 64шш878т5л 84л8 ль87ь 58ь7ь7585о5 578л587л\Новая папка8tcy95ytb9y592v8y92 882ug984928 b59bh98hb u24b98tunb89746h2nb743hnb7g45hb46b\9483yghiu4 hg95yghu4hb9864hbnu5b9 bu hn98 5n 89hh 24gh98trhbvjrtb9 h 498 <- 256 characters
Re: Custom buttons and long paths
Posted: 23 Mar 2026 20:09
by jupe
You could try prefixing the path with \\?\, unsure if it will help in your exact scenario/OS etc. though.
Re: Custom buttons and long paths
Posted: 23 Mar 2026 21:03
by niyueru
Unfortunately, I don't know where to apply the prefix... As shown in the example above, when I simply run the command `run ‘“A:\- Software\Winbox\winbox64.exe”’` while a tab with a very long path is active, I get an error. There are no files in that folder.
Re: Custom buttons and long paths
Posted: 23 Mar 2026 21:08
by jupe
It would be something like this, with the long file name selected:
Code: Select all
run """Y:\Programs\В корзину.pyw"" ""\\?\<curitem>""", "\\?\<curitempath>";
openwith """pyw"" ""Y:\Programs\В корзину.pyw""", , "\\?\<curitem>";
but it might not help.
Re: Custom buttons and long paths
Posted: 23 Mar 2026 21:20
by highend
Probably something like this:
Code: Select all
if (substr(<curitem>, 0, 2) != "\\") {
$longPath = "\\?\" . <curitem>;
} else {
$longPath = "\\?\UNC\" . trim(<curitem>, "\", "L");
}
openwith """pyw"" ""$longPath""";