Escape a string to be safely used as a shell argument, depending on the
current platform (POSIX-compliant shell or Windows cmd.exe).
On POSIX, it adds single quotes around a string and quotes/escapes any existing single
quotes.
On Windows, it adds double quotes around a string and escapes any existing problematic
characters (such as %, !, and ") by replacing them with spaces. Backslashes
are escaped by doubling them.
Escape a string to be safely used as a shell argument, depending on the current platform (POSIX-compliant shell or Windows cmd.exe).
On POSIX, it adds single quotes around a string and quotes/escapes any existing single quotes. On Windows, it adds double quotes around a string and escapes any existing problematic characters (such as %, !, and ") by replacing them with spaces. Backslashes are escaped by doubling them.