diff --git a/index.js b/index.js index f17902f..d3f69d9 100644 --- a/index.js +++ b/index.js @@ -33,7 +33,9 @@ module.exports = (target, opts) => { } else if (process.platform === 'win32' || isWsl) { cmd = 'cmd' + (isWsl ? '.exe' : ''); args.push('/c', 'start', '""', '/b'); - target = target.replace(/&/g, '^&'); + if (target.indexOf(' ') === -1) { + target = target.replace(/([&\\<>^|])/g, '^$1'); + } if (opts.wait) { args.push('/wait');