Description
Prerequisites
- I have written a descriptive issue title.
- I have searched all open and closed issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
- If this is a security issue, I have read the security issue reporting guidance.
Summary
After PowerShell Extension v2023.8.0 was installed, Terminal sets the working directory of command prompt to the directory of the folder specified in a previous session. This is new, unexpected behavior since the "PowerShell: Enable Profile Loading" option is selected and a "CurrentUserAllHosts" Profile.ps1 exists that contains a Set-Location command that sets the working directory to a different location. Note that the "PowerShell: Cwd" option is not populated (i.e., the value is empty).
The "CurrentUserAllHosts" Profile.ps1 has the following relevant commands:
New-PSDrive -Name Home -PSProvider FileSystem -Root "$([Environment]::GetFolderPath('MyDocuments'))\WindowsPowerShell" | Out-Null
Set-Location -Path Home:\
Prior to PowerShell extension v2023.8.0, Terminal would default to the correct directory, which is the path specified in the Set-Location command. So, in my case, the command prompt would display as follows:
PS Home:>
PowerShell Version
PS> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.22621.2428
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.2428
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Visual Studio Code Version
PS> code --version
1.83.1
f1b07bd25dfad64b0167beb15359ae573aecd2cc
x64
PS D:\Users\Joe\OneDrive\PowerShell>
Extension Version
PS> code --list-extensions --show-versions | Select-String powershell
[email protected]
Steps to Reproduce
- Open Visual Studio Code.
- Open a folder containing PowerShell scripts.
- View Terminal if Terminal is not visible.
- Note the command prompt and the current working directory is set to the folder that was opened.
Visuals
No response
Logs
File is attached
EditorServicesDiagnosticLevelOutput.txt
Metadata
Metadata
Assignees
Labels
Type
Projects
Status