[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

IDLE Default Working Directory

On 11/12/18, Thomas Jollans <tjol at tjol.eu> wrote:
> On 13/11/2018 00:45, Terry Reedy wrote:
>> On Windows, a simple alternate is a .bat file.  I belive the folloiwing
>> should work.
>> cd c:/desired/startup/directory
>> py -x.y -m idlelib
>> The default for x.y is latest 3.x or latest 2.x if no 3.x.
> Correct me if I'm wrong, but won't that create an empty command prompt
> window nobody wants to see? (which you can get rid of by calling
> START /B on a win32 application like pythonw.exe. Is there a pyw.exe or
> something?)

It should be something like `start "IDLE" pyw.exe -3.x -m idlelib`.
This assumes pyw.exe is in a PATH directory, which it should be if
Python 3.x was installed for all users. We need the START command to
prevent waiting for the pyw.exe command to exit. If CMD waits, then
its console window will be displayed while IDLE is running. Even with
START, CMD's console window will display briefly, which is ugly and
distracting, so ideally the OP should use a .lnk shortcut instead of a
batch script.

Note that the START command's /B option is irrelevant since pyw.exe
isn't a console application. This option makes the CreateProcess call
Without the latter flag, a console application inherits the parent's
console, and as a new process group it will have Ctrl+C disabled by
default. This allows running a console application in the
[B]ackground. (I recommend redirecting its stdin to NUL as well.)