Subj : system.exec() and commands in double-quotes
To   : Nightfox
From : Digital Man
Date : Fri Apr 11 2025 12:42 pm

 Re: system.exec() and commands in double-quotes
 By: Nightfox to Digital Man on Fri Apr 11 2025 12:20 pm

>   Re: system.exec() and commands in double-quotes
>   By: Digital Man to Nightfox on Thu Apr 10 2025 05:14 pm
>
>  DM> Okay, so no "escaped quotes" are actually being passed to system(). I
>  DM> was confused by your reply to phigan.
>
> Maybe I'm not understanding what you mean by escaped quotes..  I escaped the
> double-quotes in the string with the command because I used double-quotes
> for the whole thing.

Right, but you escaped them only for JavaScript, not the Windows command interpretter. The string being passed to system() did not appear to include any "escaped quotes".

>  DM> The end result (passed to system()) looks like it would be:
>
>  DM> ""C:\Program Files\Path\To\Program" some-arg "some-arg""
>
>  DM> That's pretty weird.
>
> Yeah, it's weird but it looks like that's what's working on Windows.
>
>  DM> One nice thing about JavaScript is you don't have to escape the
>  DM> double-quotes if you inclose the string in single-quotes. So could
>  DM> probably get away without escaping anything.
>
> I sometimes forget you can use single-quotes for strings in JS.

They're actually preferred, for strings, in a lot of JS styles, e.g.
https://google.github.io/styleguide/tsguide.html#primitive-literals

Coming from C and C++ myself, I usually default to double-quoted strings.
--
                                           digital man (rob)

Steven Wright quote #7:
A clear conscience is usually the sign of a bad memory.
Norco, CA WX: 85.4�F, 30.0% humidity, 3 mph SW wind, 0.00 inches rain/24hrs

---
� Synchronet � Vertrauen � Home of Synchronet � [vert/cvs/bbs].synchro.net