GetCommandLineA

Retrieves the command line for the current process.

Syntax
LPSTR GetCommandLineA(void);
Parameters

This function does not take any parameters.

Return value

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.

Remarks

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.

Important

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.

Requirements
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
See also