Split a command line string respecting quotes and escape characters
Contributed by:
Antonis Aristeidou
Examples
Basic Examples (2)
CommandLineSplit will break up a string into constituent argv elements keeping strings as a single unit:
Escape characters within strings are supported:
Scope (3)
Double-quoted substrings are kept together as one token:
Extra whitespace is ignored:
Empty strings are preserved:
Options (2)
An equals sign can be treated as an additional delimiter using the "TokenDelimiter" option:
A different escape character can be specified with "EscapeCharacter":
Applications (1)
Split a simple command into a form suitable for further processing:
Possible Issues (1)
Un-terminated quoted strings or escape sequences produce a Message and return a Failure:
Publisher
Antonis Aristeidou
Requirements
Wolfram Language 12.3
(May 2021) or above
Version History
-
1.0.2
– 01 May 2026
-
1.0.0
– 24 April 2026
Related Resources
Author Notes
1.0.0 | 2026-04-19