References - johnstevenson/winbox-args GitHub Wiki
General
Many thanks to the authors of the articles listed below, whose work has been invaluable when researching this subject.
Microsoft
- Parsing C++ Command-Line Arguments
- CommandLineToArgvW function
- What’s up with the strange treatment of quotation marks and backslashes by CommandLineToArgvW
- Everyone quotes command line arguments the wrong way
- Runtime argv parsing
parse_cmdlinesource code.
Others
- Everything You Need to Know About Command Lines for Windows Programs
- A Better Way To Understand Quoting and Escaping of Windows Command Line Arguments
- How a Windows Program Splits Its Command Line Into Individual Arguments
The above three articles are part of an excellent series and include diagrams and sample programs.
- How Command Line Parameters Are Parsed
- How does the Windows Command Interpreter (CMD.EXE) parse scripts?
- How can I escape an exclamation mark ! in cmd scripts?
PHP
Documentation
Source Code
- ext/standard/exec.c
exec,system,passthru,shell_exec - ext/standard/file.c
popen - TSRM/tsrm_win32.c
popen_ex(called by the above) - ext/standard/proc_open.c
proc_open