Re: process' command line

From: Jochen Kalmbach (nospam-Jochen.Kalmbach_at_holzma.de)
Date: 11/09/04


Date: Tue, 09 Nov 2004 10:25:24 -0800

Hi qfel,

> Nope; If I call CreateProcess with both exe path and cmdline set,
> they're not merged, so I don't get exe path in command line.
> BTW
> "Console processes written in C can use the argc and argv arguments to
> parse the command line. Because argv[0] is the module name, C
> programmers generally repeat the module name as the first token in the
> command line." Generally means you have no guarantee that it will be
> so.

But GetCommandLine *will* always return the command line.

Or at least: this is the only function to get something like a command-
line.

You can use "GtModuleFileName(NULL, ...)" to get the real EXE-Name and then
you can check with the first paremeter if this is the EXE-Name (of course
this is not trivial, because it might be with(out) path and/or short-
filename).

The first paremeter is always until the first space occurs, or if it is
queoted, until the next quote (") occurs.

-- 
Greetings
  Jochen
 
   My blog about Win32 and .NET
   http://blog.kalmbachnet.de/


Relevant Pages

  • 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)
  • 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: 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)