open and backslashes...

From: Jeff Godfrey (jeff_godfrey_at_pobox.com)
Date: 03/25/05


Date: Fri, 25 Mar 2005 13:03:25 -0600

Hi All,

Under WinXP, given a user supplied program command line, such as:

set cmd {c:\path\to\myprog.exe -F 1 -G 2:2 -Q "a text parm"}

What is the best/safest way to make the above "acceptable" to the open
command, as in:

open "|$cmd"

It seems that I need to convert the (possible) backslashes in the exe path
to forward slashes for open, but I don't want to break anything else in the
supplied command line. Also, I suppose the exe path could contain spaces...

I've managed to kludge my way through the above issue several times in the
past, but am wondering if there is a canonical way of accomplishing this?

Thanks for any suggestions.

Jeff



Relevant Pages

  • Re: open and backslashes...
    ... > Under WinXP, given a user supplied program command line, such as: ... I suppose the exe path could contain spaces... ... set cmd ...
    (comp.lang.tcl)
  • Re: process command line
    ... so I don't get exe path in command line. ... " to get the real EXE-Name and then ... The first paremeter is always until the first space occurs, ...
    (microsoft.public.win32.programmer.kernel)
  • Re: process command line
    ... If I call CreateProcess with both exe path and cmdline set, ... so I don't get exe path in command line. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Registering a dll
    ... I resolved this issue by using Execute and specifying the EXE path to ... %syswin%\system32\regsvr32 and /s printcontrol.dll in the command line. ... "Dave Halperin" wrote: ...
    (microsoft.public.sms.misc)
  • Re: open and backslashes...
    ... > Jeff Godfrey wrote: ... command line for an executable. ... backslashes in the actual exe path, and in one or more of the arguments for ... I need to break out the "exe" name from the command line string prior to ...
    (comp.lang.tcl)