Skip to content

Running PowerShell script with F5 changes current directory #1330

Closed
@SlyEcho

Description

@SlyEcho

System Details

  • Operating system name and version: Windows 10
  • VS Code version: 1.23.1
  • PowerShell extension version: 1.7.0
  • Output from $PSVersionTable:
Name                           Value
----                           -----
PSVersion                      5.1.17134.48
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.48
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

Running PowerShell script with F5 changes current directory to the same folder that the script is located in.

Most of my scripts are written in a way that don't reference a specific fixed path but work with files in $PWD. If I need any files from the script's folder I can use $PSScriptRoot.

This behavior is unexpected and different from the ISE, and is preventing me from moving over to VS Code.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions