Answers

The value of the PATH environment variable has very little to do with the difference between python.exe and pythonw.exe. What you need to know about PATH, or environment variables in general, is that they are usually inherited from the calling process.

So when you call python.exe from the command line, then that process will inherit the value of PATH that the command line had. If you open IDLE using some shortcut, then it will inherit the value from Windows.

Every process can mess with the environment variables as much as they like; and as such affect processes they start. For example:

And just like that I created a new environment variable FOO which was passed automatically to the process I was starting (Python 3), which could access it there.

The same really applies to the PATH environment variable. If you are seeing differences there, it’s likely not because your executable is different, but more because the calling process may have affected it in a different way.