diff --git a/extensions/notebook/src/jupyter/jupyterSessionManager.ts b/extensions/notebook/src/jupyter/jupyterSessionManager.ts index 01b613c973..6d8ab65558 100644 --- a/extensions/notebook/src/jupyter/jupyterSessionManager.ts +++ b/extensions/notebook/src/jupyter/jupyterSessionManager.ts @@ -382,7 +382,8 @@ export class JupyterSession implements nb.ISession { } private async setEnvironmentVars(skip: boolean = false): Promise { - if (!skip && this.sessionImpl) { + // The PowerShell kernel doesn't define the %cd and %set_env magics; no need to run those here then + if (!skip && this.sessionImpl?.kernel?.name !== 'powershell') { let allCode: string = ''; // Ensure cwd matches notebook path (this follows Jupyter behavior) if (this.path && path.dirname(this.path)) {