diff --git a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts index 1a6926f25e962..3135535e4ae73 100644 --- a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts +++ b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts @@ -1443,9 +1443,9 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { let commandLine = result.join(' '); // There are special rules quoted command line in cmd.exe if (platform === Platform.Platform.Windows) { - if (shellExecutable === 'cmd' && commandQuoted && argQuoted) { + if (basename === 'cmd' && commandQuoted && argQuoted) { commandLine = '"' + commandLine + '"'; - } else if ((shellExecutable === 'powershell' || shellExecutable === 'pwsh') && commandQuoted) { + } else if ((basename === 'powershell' || basename === 'pwsh') && commandQuoted) { commandLine = '& ' + commandLine; } }