Python on Windows doesn't accept cmd line args (original) (raw)

I have installed Python (3.14.3) on Windows using the new Windows Installer (25.2)
I previously had Python(s) 3.12, 3.13 and 3.14.2 installed using the “old” installer. All of those were uninstalled, machine rebooted.

From the command line, py launches the interpreter, as does python and python3 and python3.14. All good.

Running my script in different ways gives problematic behaviour:

# myscript.py
import os
import sys

print(sys.executable)
print(sys.version)

os.system('py --version')
os.system('python --version')
os.system('python3 --version')

print(f'There are {len(sys.argv)} cmd line args')
print(sys.argv)

Working way 1:

If I run my script with py it works fine, and receives the cmd line args.

C:\wrk> py myscript.py one two three
C:\Users\Peter\AppData\Local\Python\pythoncore-3.14-64\python.exe
3.14.3 (tags/v3.14.3:323c59a, Feb  3 2026, 16:04:56) [MSC v.1944 64 bit (AMD64)]
Python 3.14.3
Python 3.14.3
Python 3.14.3
There are 4 cmd line args
['myscript.py', 'one', 'two', 'three']
C:\wrk>

Failing way 2:

If I run my script with the association the script runs, but doesn’t receive my command line args, and the launches for python and python3 emit “Access is denied” messages.

C:\wrk> myscript.py one two three
C:\Users\Peter\AppData\Local\Python\pythoncore-3.14-64\python.exe
3.14.3 (tags/v3.14.3:323c59a, Feb  3 2026, 16:04:56) [MSC v.1944 64 bit (AMD64)]
Python 3.14.3
Access is denied.
Access is denied.
There are 1 cmd line args
['C:\\wrk\\myscript.py']
C:\wrk>

Failing way 3:

I can also launch the program using the PATHEXT, but this also gives the erroneous behaviour.

C:\wrk> echo %PATHEXT% 
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY
C:\wrk> myscript one two three
C:\Users\Peter\AppData\Local\Python\pythoncore-3.14-64\python.exe
3.14.3 (tags/v3.14.3:323c59a, Feb  3 2026, 16:04:56) [MSC v.1944 64 bit (AMD64)]
Python 3.14.3
Access is denied.
Access is denied.
There are 1 cmd line args
['C:\\wrk\\myscript.py']
C:\wrk>

The previous install of python had the way 1, way 2 and way 3 all working with the same result as way 1. So it seems to be something to do with how the new Windows Installer is setting it up. Is this a bug in the new Windows installer? Is there some setting not being set/being set incorrectly? How can I work around this? (I have some idea it has to do with associations and “%*”, but I’m not sure where to set that.)

Any ideas or solution most welcome.