Re: open and backslashes...

From: Gerald W. Lester (Gerald.Lester_at_cox.net)
Date: 03/25/05


Date: Fri, 25 Mar 2005 16:46:37 -0600

Jeff Godfrey wrote:
> 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...
>...

set cmdList [split $cmd]
lset cmdList 0 [file normalize [lindex $cmdList 0]]
set cmd [join $cmdList]

-- 
+--------------------------------+---------------------------------------+
| Gerald W. Lester               | "The man who fights for his ideals is |
| Gerald.Lester@cox.net          |  the man who is alive." -- Cervantes  |
+--------------------------------+---------------------------------------+


Relevant Pages

  • open and backslashes...
    ... Under WinXP, given a user supplied program command line, such as: ... What is the best/safest way to make the above "acceptable" to the open ... I suppose the exe path could contain spaces... ...
    (comp.lang.tcl)
  • Re: "-command" option, where argument of a procedure has space...
    ... The command option looked like: ... Procedure makeThis has been defined, that it has just one argument. ... set cmd ... set parmB "parmB" ...
    (comp.lang.tcl)
  • Re: Query with Command object ADO
    ... need to tell the Command object what type of command to execute. ... Dim cn As ADODB.Connection ... Set cmd = New ADODB.Command ...
    (microsoft.public.access.modulesdaovba)
  • 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)