Apparently, the command line is returned different for a console
program and a Win GUI program. I get the --
"c:\bxcon\bxcon.exe program agrs" with a console app.
With a GUI app I get just the program ars. Is this correct?
Posted on 2002-06-15 21:46:21 by Roy Cline
No, the GUI one's command line is also "c:\bxcon\bxcon.exe program agrs".
Posted on 2002-06-15 22:32:32 by C.Z.
Peculiar thing is, I get something like:


when starting from Windows Explorer, but:


when starting from QEditor!

BUT if the path is say:

e:\masm32\ggwin\gmen temp.exe

QEditor also gives the same result as Win Explorer...

"E:\masm32\ggwin\gmen temp.exe"
Posted on 2002-06-17 03:35:16 by AmkG
I think the quotes are used if there are spaces...
Posted on 2002-06-17 04:05:02 by MArtial_Code
Yes QEditor does that, but WinExplorer always gives "" regardless of whether or not spaces are in the path. This is in Win98SE BTW.
Posted on 2002-06-17 04:42:36 by AmkG - PathUnquoteSpaces

will remove those quotes.
Posted on 2002-06-17 05:21:35 by gfalen
Unfortunately what turns up as a command line varies from windows version to another and from app to app in each version,WinExec/CreateProcess, command prompt, Winfile and Explorer all treat the command line differently, some add quotes around all the text, some don't so do it only when there are long file names.

I have used the SHLWAPI functions to try and get it to work across more versions but the range of variations seem to beat it.

Funny I never get the problem on any of my own boxes, I set them up from scratch to show all files and extension types so I have never been able to test it as every case works OK on my own machines.

I get the idea that Microsoft is not all that interested in providing a consistent command line system for windows.

Posted on 2002-06-17 05:31:53 by hutch--
Shlwapi has some very handy functions indeed. I use them alot. Saves a lot of time I would otherwise spend coding a proc or lib function. Plus saves code space which is a big plus with me.

Slightly OT but for those who need to search for a specific file, Imghlp.lib (and Dbghelp.lib - i think) has the "SearchTreeForFile" function which can search a path (the whole disk if you specify the root) for the first occurance of a specific file.
Posted on 2002-06-17 05:44:09 by gfalen
The logic for handling all commandline variations is not very hard -
it's pretty trivial string operations with a few if's and for loops.
Posted on 2002-06-17 07:59:35 by f0dder