Skip to content

Add documentation on how PowerShell uses PATHEXT to run other interpreter scripts in the same console #8346

@rkeithhill

Description

@rkeithhill

Summary of the new document or enhancement

This request is a WG-Engine outcome from this PowerShell issue. We need a bit of documentation in some about topic that discusses how a user can configure $env:PATHEXT to run scripts for other interpreters in the same console. Right now if I have a Perl or Python script and I try to run the script with specifying the interpreter first e.g..\hello.pl or .\hello.py, those scripts are started in a separate console which is unfortunate if you wanted to capture stdout from those scripts in the current session.

The fix for this is to add the interpreter's script extension to the PATHEXT environment variable e.g.:

# default
PATHEXT  = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL

# add Python
PATHEXT  = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL;.PY

# add Perl
PATHEXT  = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL;.PL

Details of requested document:

  • Proposed title: I think this integrates into existing help topics
  • Propose location in the TOC: about_Environment_Variables, about_Command_Precedence (section 4 external executable files)
  • Target audience: devs & admins
  • Purpose or scenario: Inform users how PowerShell uses PATHEXT and how they can configure PATHEXT to run other interpreter scripts within the same console.
    or
    Proposed changes/additions to existing article:
  • List of related articles to link to:

Metadata

Metadata

Assignees

Labels

area-aboutArea - About_ topics

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions