MFC command-line parameters get
int Nnum= 0;
LPWSTR* LP=COMMANDLINETOARGVW(getcommandlinew(), &nnum);
ASSERT (0);
for (int i = 0; I<nnum; I+ +)
{
AfxMessageBox (Lp[i]);
}
When calling Aa.exe with Aa.bat or entering "aa.exe-999" at the command prompt, the 1th command line parameter received by Aa.exe is the path to EXE, and the 2nd is-999
When you create an EXE in CreateProcess, there is no default 1th parameter, so the command line arguments need to be passed in from the 2nd argument
CreateProcess only the 1th argument to start the specified process, which means CreateProcess ("", "aa.exe-123" ...) is unable to start the process
Either way, the default delimiter is a space, so if you want to pass the path, there is no space in the path, if you can not guarantee, you may add quotation marks at both ends of the argument, such as: Test322.exe "C:\aa bb\cc DD"
When you enter "aa.exe-999" at the command prompt, the operating system will have an encoding conversion process, that is, you do not need to care whether Aa.exe is ANSI or Unicode encoding
This article is from "Bobo software qq:3083279843" blog, please be sure to keep this source http://boyka3721.blog.51cto.com/10568852/1681941
About command-line arguments