diff --git a/package.json b/package.json index 6be8cea30c..17be43133f 100644 --- a/package.json +++ b/package.json @@ -640,6 +640,11 @@ "default": "BlockComment", "description": "Controls the comment-based help completion behavior triggered by typing '##'. Set the generated help style with 'BlockComment' or 'LineComment'. Disable the feature with 'Disabled'." }, + "powershell.cwd": { + "type": "string", + "default": null, + "description": "An explicit start path where the Powershell Integrated Console will be launched. Both the PowerShell process and the shell's location will be set to this directory. Predefined variables can be used (i.e. ${fileDirname} to use the current opened file's directory)." + }, "powershell.scriptAnalysis.enable": { "type": "boolean", "default": true, diff --git a/src/process.ts b/src/process.ts index 80b849ef48..7f9f08b185 100644 --- a/src/process.ts +++ b/src/process.ts @@ -112,6 +112,7 @@ export class PowerShellProcess { shellPath: this.exePath, shellArgs: powerShellArgs, hideFromUser: !this.sessionSettings.integratedConsole.showOnStartup, + cwd: this.sessionSettings.cwd }); const pwshName = path.basename(this.exePath); diff --git a/src/settings.ts b/src/settings.ts index defbdd9e7a..9cd5883084 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -101,6 +101,7 @@ export interface ISettings { sideBar?: ISideBarSettings; pester?: IPesterSettings; buttons?: IButtonSettings; + cwd?: string; } export interface IStartAsLoginShellSettings { @@ -257,6 +258,8 @@ export function load(): ISettings { // is the reason terminals on macOS typically run login shells by default which set up // the environment. See http://unix.stackexchange.com/a/119675/115410" configuration.get("startAsLoginShell", defaultStartAsLoginShellSettings), + cwd: + configuration.get("cwd", null), }; }