Subj : system.exec() and commands in double-quotes
To : Nightfox
From : Digital Man
Date : Thu Apr 10 2025 05:14 pm
Re: system.exec() and commands in double-quotes
By: Nightfox to Digital Man on Thu Apr 10 2025 04:42 pm
> Re: system.exec() and commands in double-quotes
> By: Digital Man to Nightfox on Thu Apr 10 2025 03:47 pm
>
> >>>> If I remove the double-quotes around the source filename & destination
> >>>> filename, so that there's only one set of double-quotes in the command
> >> line
>
> > ph>> What if you do something silly and put the whole thing in one set
> > of
> > ph>> quotes, then escape the quotes inside?
>
> >> That seems to work.. Thanks for the suggestion. And it seems to only
> be
> >> necessary on Windows.
>
> DM> Maybe share the code?
>
> It's failry simple, basically just adding double-quotes around the whole
> command if you know the command has multiple sets of double-quotes.
>
> I pasted the section of code on Pastebin:
>
>
https://pastebin.com/pPXfHKeP
Okay, so no "escaped quotes" are actually being passed to system(). I was confused by your reply to phigan.
The end result (passed to system()) looks like it would be:
""C:\Program Files\Path\To\Program" some-arg "some-arg""
That's pretty weird.
One nice thing about JavaScript is you don't have to escape the double-quotes if you inclose the string in single-quotes. So could probably get away without escaping anything.
--
digital man (rob)
This Is Spinal Tap quote #17:
David St. Hubbins: It's such a fine line between stupid, and uh... and clever.
Norco, CA WX: 82.3�F, 27.0% humidity, 11 mph W wind, 0.00 inches rain/24hrs
---
� Synchronet � Vertrauen � Home of Synchronet � [vert/cvs/bbs].synchro.net