escapeWin32CmdCommandArg
escapeWin32CmdCommandArg(
expr):string
Defined in: command/escape-win32-cmd-command-arg.ts:19
Escape a string to be safely used as a shell argument in Windows cmd.exe
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.
Example:
const unsafe = 'A "complex" %string% with !special! chars \\';const safe = escapeShellArgWindows(unsafe);console.log(safe); // "A complex string with special chars \\"Parameters
Section titled “Parameters”string
The string to escape
Returns
Section titled “Returns”string
The escaped string