export function quotePowerShellLiteral(value: string): string { // Why: PowerShell also ends single-quoted strings at typographic single quotes. return `'${value.replace(/['\u2018\u2019\u201A\u201B]/g, '$&$&')}'` } export function quotePowerShellNativeArgument(value: string): string { // Why: Windows PowerShell 5.1 drops unescaped embedded quotes when it // constructs argv for native executables such as wsl.exe. return quotePowerShellLiteral(value.replace(/(\\*)"/g, '$1$1\\"')) }