GetCommandLineW function (processenv.h)
Retrieves the command-line string for the current process.
The return value is a pointer to the command-line string for the current process.
The lifetime of the returned value is managed by the system, applications should not free or modify this value.
Console processes can use the argc and argv arguments of the main or wmain functions by implementing those as the program entry point. GUI processes can use the lpCmdLine argument of the WinMain or wWinMain functions by implementing those as the program entry point.
To convert the command line to an argv style array of strings, pass the result from GetCommandLineW to CommandLineToArgvW.
The processenv.h header defines GetCommandLine as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
|Minimum supported client||Windows XP [desktop apps | UWP apps]|
|Minimum supported server||Windows Server 2003 [desktop apps | UWP apps]|
|Header||processenv.h (include Windows.h on Windows Server 2003, Windows Vista, Windows 7, Windows Server 2008 Windows Server 2008 R2)|