More > JRiver Media Center 32 for Mac

Links: Opening External Program

<< < (4/7) > >>

bob:

--- Quote from: zybex on January 30, 2024, 06:36:13 pm ---Thanks Bob :)
Does it handle quoted args?
arg1 "arg2 with spaces" arg3 ...

--- End quote ---
Yes but I don't think it handles more than one arg.
From what I can tell the windows one didn't.

zybex:
This works in windows:

Program: cmd.exe
Args: //k echo "[Filename]" && echo [Artist]

The win32 API CreateProcess() takes a single string with the full command line to execute and splits the args itself - the caller just sends the whole thing. The ShellExecute() takes the executable name plus a second string with all args as well.

bob:

--- Quote from: zybex on January 30, 2024, 07:05:15 pm ---This works in windows:

Program: cmd.exe
Args: //k echo "[Filename]" && echo [Artist]

The win32 API CreateProcess() takes a single string with the full command line to execute and splits the args itself - the caller just sends the whole thing. The ShellExecute() takes the executable name plus a second string with all args as well.

--- End quote ---
Yeah, I doubt that will work on Mac as I wrote it. If it doesn't I'll see about splittng the args.

MrBiff:
Great, thank you very much.

The argument passing and quoting rules for commands executed via cmd.exe were insanely stupid and naive.  One of the rules: a single string argument that has exactly two double quotes, at the beginning and end, gets handled specially.  So it was common to think of these command arguments as a single string.

PowerShell, while a very odd duck, supports handling arbitrary command line arguments via single base64 encoded string.   This eliminates all the impossible-to-handle quoting issues that have been present in the MS command line environment for ~40 years.

The first time I had to write Win32 code, and was gobsmacked when I read that CreateProcess took a string argument (...use quoted strings to indicate where the file name ends and the arguments begin...).  Oye.

MrBiff:

--- Quote from: bob on January 30, 2024, 07:17:59 pm ---Yeah, I doubt that will work on Mac as I wrote it. If it doesn't I'll see about splittng the args.

--- End quote ---

I'll definitively need arguments as individual ARGV items.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version