It tries to make sense of the command line but if not passes it verbatim to CreateProcess. This is why cmd can execute programs renamed to text files as CP doesn't care about extensions (except to add .exe to files without an extension) but opens the file to see how to execute (as there are many types of executable files).
lpCommandLine
[in, out] Pointer to a null-terminated string that specifies the command line to execute.
Windows NT/2000/XP: The Unicode version of this function, CreateProcessW, will fail if this parameter is a const string.
The lpCommandLine parameter can be NULL. In that case, the function uses the string pointed to by lpApplicationName as the command line.
If both lpApplicationName and lpCommandLine are non-NULL, *lpApplicationName specifies the module to execute, and *lpCommandLine specifies the command line. The new process can use GetCommandLine to retrieve the entire command line. C runtime processes can use the argc and argv arguments. Note that it is a common practice to repeat the module name as the first token in the command line.
If lpApplicationName is NULL, the first white-space – delimited token of the command line specifies the module name. If you are using a long file name that contains a space, use quoted strings to indicate where the file name ends and the arguments begin (see the explanation for the lpApplicationName parameter). If the file name does not contain an extension, .exe is appended. Therefore, if the file name extension is ..com, this parameter must include the .com extension. If the file name ends in a period (.) with no extension, or if the file name contains a path, .exe is not appended. If the file name does not contain a directory path, the system searches for the executable file in the following sequence:
1.. The directory from which the application loaded.
2.. The current directory for the parent process.
3.. Windows 95/98/Me: The Windows system directory. Use the GetSystemDirectory function to get the path of this directory.
Windows NT/2000/XP: The 32-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory. The name of this directory is System32.
4.. Windows NT/2000/XP: The 16-bit Windows system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System.
5.. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
6.. The directories that are listed in the PATH environment variable.
The system adds a null character to the command line string to separate the file name from the arguments. This divides the original string into two strings for internal processing.
--
--------------------------------------------------------------------------------------------------
Read David defending the concept of violence.
http://margokingston.typepad.com/harry_version_2/2005/10/entering_the_ga.html#more
=================================================
Al Dunbar said:
foxidrive said:
On Wed, 19 Oct 2005 18:46:30 +0200, Michael Moser wrote:
Tell us more about this program.
A good point. Perhaps it is not CMD that is having difficulty swallowing
this.
I believe that cmd.exe will pass whatever is given on the commandline. The
following demonstrates this on Windows XP:
@echo off
call:sub param
call:sub "param"
call:sub "par"ram"
call:sub "par""ram"
goto:eof
:sub
echo/[%1]
goto:eof
The values displayed in the brackets by the echo command are all exactly
character for character what appears in the respective call:sub lines.
/Al