I installed the Python Install Manager on a Windows 11 machine that never had it installed before.
Next, I created a short program, hello.py, containing a single print function:
In a new PowerShell terminal window, I ran it:
PS C:\Users\username\Scripts> .\hello.py
Windows spawns a separate terminal window to run it, which closes immediately. As noted in #193 this is currently "just how it works," but there seems to be a better way: Update the PATHEXT environment variable to include Python filename extensions where the user can reasonably expect that the Python program will run in the current terminal:
PS C:\Users\username\Scripts> $env:PATHEXT += ";.PY"
PS C:\Users\username\Scripts> .\hello.py
Hello, world
After adding .PY to PATHEXT and running hello.py by name, it ran in the current terminal window.
Accordingly, it would seem sensible to add a configuration step that adds .PY (and anything else appropriate) to the PATHEXT environment variable.
I installed the Python Install Manager on a Windows 11 machine that never had it installed before.
Next, I created a short program,
hello.py, containing a singleprintfunction:In a new PowerShell terminal window, I ran it:
Windows spawns a separate terminal window to run it, which closes immediately. As noted in #193 this is currently "just how it works," but there seems to be a better way: Update the
PATHEXTenvironment variable to include Python filename extensions where the user can reasonably expect that the Python program will run in the current terminal:After adding
.PYtoPATHEXTand runninghello.pyby name, it ran in the current terminal window.Accordingly, it would seem sensible to add a configuration step that adds
.PY(and anything else appropriate) to thePATHEXTenvironment variable.