Skip to content

Extensions of non-PowerShell scripts (such as .pl for Perl scripts etc.) must be listed in PATHEXT in order for the script to be run in the same console. #15854

@ReneNyffenegger

Description

@ReneNyffenegger

Prerequisites

Steps to reproduce

When trying to run a non-PowerShell script whose filename extension is associated with a script interpreter, for example using the cmd.exe commands ftype and assfoc, the script extension (for example .pl for Perl scripts), this extension must be listed in the PATHEXT environment variable in order for this script to be run in the same console as the one from which the script was started (if the script is started without specifying the interpreter executable). If this extension is not listed in PATHEXT, PowerShell will open a new console and run the script in this new console. (See also this Stackoverflow question and its accepted answer).

Expected behavior

I would have expected the script to be run in the current console regardless of its extension being listed in `PATHEXT`.

Actual behavior

Executing the script opens a new Console

Error details

none

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.19041.1023
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1023
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Visuals

No response

Metadata

Metadata

Assignees

Labels

Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-AnsweredThe question is answered.WG-Enginecore PowerShell engine, interpreter, and runtime

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions