[Info-vax] Command Line Versus Command Line
Michael S
already5chosen at yahoo.com
Sat May 25 19:31:00 EDT 2024
On Fri, 24 May 2024 20:02:46 -0400
Arne Vajhøj <arne at vajhoej.dk> wrote:
> On 5/24/2024 12:05 PM, Michael S wrote:
> > On Fri, 24 May 2024 11:28:05 -0400
> > Arne Vajhøj <arne at vajhoej.dk> wrote:
> >> On 5/24/2024 11:11 AM, Michael S wrote:
> >>> It seems like the simplest solution is to not try to run batch
> >>> files by means of spawn("cmd.exe", ...) or
> >>> CreateProcess("cmd.exe", ...). They could have use more
> >>> specialized function: system() from C RTL or ShellExecuteEx()
> >>> from Win32 API. The former is easier to use, the later works as
> >>> expected in wider range of host console environments, most
> >>> importantly, it works from mintty.
> >>
> >> Both system and ShellExecuteEx still take all parameters as a
> >> single string, which require some non-trivial conversion from
> >> array of parameters to that string.
> >
> > Conversion is actually trivial - dumb double-quoting.
>
> Maybe.
>
> > There is an opposite problem - the child will get parameters
> > together with double quotes.
>
> They should be stripped by the shell.
>
It does not work like that.
For programs that use CommandLineToArgv() either directly or via C-alike
sturtup code, you'll get double quotes stripped. But internal commands
in batch file, e.g echo, will see the double quotes. It's probably
the most harmful for batch files that use 'IF %N==string' logic.
> Arne
>
More information about the Info-vax
mailing list