I am experimenting with command lines. I can successfully get and use all the command lines passed to my program. But, I can't get the whole command line.
Say I have a shortcut to my program like this:
"C:\My Program.exe" /hello | |
What I get is just
C:\My Program.exe
/hello
|
|
As you can see it takes the spaces out; it uses them as delimeters.
However, I have a program (no source) that gets the entire command line exactly as it appears in the shortcut properties. How can this be done in C++?
Can't be done in standard C++ to my knowledge. And it's probably not a good idea to do that anyway as it's expected behavior for spaces to be used as delimeters.
You should be able to do it with platform specific solutions. WinAPI might have something like GetCommandLineString() or something (that's a total guess, btw, but I find that you can usually guess what WinAPI functions will be named, so it's gotta be that or something very similar. Fish around on msdn)