Search code examples
pythonwindows

Is it possible to change default directory for WinPython Command Prompt.exe?


When I run "WinPython Command Prompt.exe", the working directory defaults to the scripts directory of the installation.

Creating a shortcut to run the exe with a specific working directory does not seem to have an effect.

Is it possible to have the directory after running "WinPython Command Prompt.exe" be something other than the scripts directory?


Solution

  • The exe runs cmd.bat in the scripts directory. It doesn't seem like the exe is passing "start in" or any parameters along.

    To change the default start directory I modified cmd.bat instead:

    @echo off
    call "%~dp0env_for_icons.bat"
    cmd.exe /k cd /d d:\python
    

    Update:

    second possibility is to pass all arguments in cmd.bat:

    @echo off
    call "%~dp0env_for_icons.bat"
    cmd.exe /k %*
    

    After that you can create a customized shortcut with the Target: "C:\WPy64-3870\WinPython Command Prompt.exe" cd /d d:\python