Retrieves the command line for the current process.
LPSTR GetCommandLineA(void);
This function does not take any parameters.
The return value is a pointer to the null-terminated string that specifies the command line for the current process. Do not modify this string.
The command line is the line that was used to start the current process. It is typically used by the command interpreter or shell program.
The string returned by GetCommandLineA
is stored in read-only memory. Do not modify this string.
If you need to parse the command line, you can use the CommandLineToArgvW
function.
For new development, use GetCommandLineW
to retrieve the command line in Unicode. Otherwise, your application may not function correctly on systems that do not support ANSI. GetCommandLineW
is the preferred method.
Component | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Header | winbase.h |
Library | Use Kernel32.lib |
DLL | Use Kernel32.dll |