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?
Custom buttons and long paths
-
niyueru
- Posts: 4
- Joined: 23 Mar 2026 12:23
Custom buttons and long paths
You do not have the required permissions to view the files attached to this post.
-
highend
- Posts: 14923
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Custom buttons and long paths
File (full path = 269 characters):
Entry for the button:
Notepad opens the file just fine when executed?
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.txtCode: Select all
openwith """notepad"" ""<curitem>""";One of my scripts helped you out? Please donate via Paypal
-
niyueru
- Posts: 4
- Joined: 23 Mar 2026 12:23
Re: Custom buttons and long paths
259 characters - yes
more than 259 - no (The system cannot find the specified path.)
more than 259 - no (The system cannot find the specified path.)
-
Raf
- Posts: 145
- Joined: 31 Jul 2024 15:34
Re: Custom buttons and long paths
I can suggest use intermediate layer like AutoHotkey:
- Download v2.
- Install and make sure that file assoc. was updated.
- Create
Run.ahkanywhere: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
Code: Select all
run lax(Run.exe "<curitem>")
-
niyueru
- Posts: 4
- Joined: 23 Mar 2026 12:23
Re: Custom buttons and long paths
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
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
You do not have the required permissions to view the files attached to this post.
-
jupe
- Posts: 3446
- Joined: 20 Oct 2017 21:14
- Location: Win10 22H2 120dpi
Re: Custom buttons and long paths
You could try prefixing the path with
\\?\, unsure if it will help in your exact scenario/OS etc. though.-
niyueru
- Posts: 4
- Joined: 23 Mar 2026 12:23
Re: Custom buttons and long paths
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.
-
jupe
- Posts: 3446
- Joined: 20 Oct 2017 21:14
- Location: Win10 22H2 120dpi
Re: Custom buttons and long paths
It would be something like this, with the long file name selected:
but it might not help.
Code: Select all
run """Y:\Programs\В корзину.pyw"" ""\\?\<curitem>""", "\\?\<curitempath>";
openwith """pyw"" ""Y:\Programs\В корзину.pyw""", , "\\?\<curitem>";-
highend
- Posts: 14923
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Custom buttons and long paths
Probably something like this:
Code: Select all
if (substr(<curitem>, 0, 2) != "\\") {
$longPath = "\\?\" . <curitem>;
} else {
$longPath = "\\?\UNC\" . trim(<curitem>, "\", "L");
}
openwith """pyw"" ""$longPath""";
One of my scripts helped you out? Please donate via Paypal
XYplorer Beta Club