The reason why you're not getting parameters is because you broke the .py
association so you could double-click those files to open them in NotePad++,
and subsequently broke the .pyw association to do what .py is supposed to do.
In short, you forgot to include the %*
at the end of your Python.exe command
line for your "customized" (mangled) .pyw association.
The ASSOC and FTYPE commands are used to show associations and file types, ie,
what program gets run to handle a file with a particular extension. Here is
what those commands produce on my system:
C:est>assoc .py
.py=Python.File
C:est>assoc .pyw
.pyw=Python.NoConFile
C:est>ftype python.file
python.file="C:Python27python.exe" "%1" %*
C:est>ftype python.noconfile
python.noconfile="C:Python27pythonw.exe" "%1" %*
The normal .py association runs python.exe with a console window so that you
can see the output of print statements.
The normal .pyw association runs pythonw.exe with no console window.
You can see at the end of each command line, there is a %*
. This is what sends
the parameters to a command. (Actually, %1
is the first parameter, and %*
means "all remaining parameters".)
When you try to run a python file at the command line without typing its
extension or the initial "python" command, a few things happen.
First the PATHEXT environment variable is used to find a matching extension.
In your case it finds that your command name "gcc_opt" + .PYW results in a
matching file.
Then the association for .PYW files is looked up, which finds the filetype
Python.NoConFile, which in your case is set to "python.exe" (supposed to be
pythonw.exe). (You can see these in the registry under HKEY_CLASSES_ROOT.)
The system then creates an actual command line from the command template found
for that filetype, which in your case is probably
"[your-python-path]python.exe" "%1"
This tells it to use just the first parameter, your python script name
"gcc_opt.pyw".
The quick fix is to add the %*
to the end of that command.
The CORRECT fix would be to put things back to the correct associations and
open Python files for editing by a more standard method (drop icon onto
NotePad++, or maybe right click and Edit with NotePad++).