the command line is too long

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
suslo
Posts: 178
Joined: 02 Feb 2015 05:02

the command line is too long

Post by suslo »

(windows-2003, sp2, 32-bit, 32gb ram)

1 of my scripts contains the line:
openwith "C:\Program Files\Foobar\foobar2000.exe"
the idea is to automatically add all selected flac-files to foobar. it works fine but with small quantity of characters only

recently i saw this error (when trying to add just 18 files with not so long names/paths):
Failed to open:
C:\Program Files\Foobar\foobar2000.exe
Probable reason: The command line (2069 characters) is too long
so i decided to go another way and added flac>C:\Program Files\Foobar\foobar2000.exe
to the "open with -> customize file associations" window

and after that i tried to add the selected flac-files to foobar just by pressing enter (instead of using the openwith command)
but the "Failed to open" error is appearing anyway

with no success i also tried to use different 'command line interpreter' (instead of cmd.exe): console2, consoleZ
these arguments do not help: <command> <items> <path 1> <curname> (absence of an argument does not help too)
is there a way to do something?

jupe
Posts: 2797
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: the command line is too long

Post by jupe »

I have never used foobar, so can't say this works for sure but you could try it this way instead:

Code: Select all

run """C:\Program Files\Foobar\foobar2000.exe"" <selitems>";
I think there is a limit to how many you can transfer via command line at once, if that is the case a workaround would be creating a temporary playlist file and importing that instead.

edit: The above probably won't work either because it seems WinXP had a path limit of only 2048 so I assume it is the same for Win2003 (the limit has been increased in more recent versions of Windows though), so if you are getting to that limit then the next best option AFAIK is making an intermediate playlist file, or upgrading Windows.

Here is one option of a script you should be able to adapt to you needs, that is if you don't want to start from scratch with your own script.
viewtopic.php?f=7&t=16837&p=152930#p144843

edit2: Although not recommended, something similar to this might work as well with a bit of tweaking (dependent on foobar):

Code: Select all

	foreach($item, <get selecteditemspathnames |>) {
		run """C:\Program Files\Foobar\foobar2000.exe"" /add ""$item""";
		wait 10;
	}

suslo
Posts: 178
Joined: 02 Feb 2015 05:02

Re: the command line is too long

Post by suslo »

something similar to this might work
it works, thank you
with a bit of tweaking (dependent on foobar)
tweaking wasn't necessary

Post Reply