To enable switching between local Leo version (typically Bazaar branches) invoked when opening Leo from the Windows Explorer the following batch files can be used:

Leo.bat - Executed when a .leo file is opened (double-clicked)

Update the "cd" command in the file to point to your Python directory

Associate the Leo.bat to your .leo files by:

Right click on on a .leo file in explorer

Select "Open with" from the pop-up menu

Select "Choose program..."

Check the "Always use the selected program..." box

Browse to and select your Leo.bat file

Leo_Set-???.bat - Executed to set the Leo branch to use

Replace "???" with the name of the branch.

Change the echo command to your path to

The Leo_Set-???.bat files create a c:\Leo_Exe_Path.txt file to store the path to the selected branch. The Leo.bat file reads from the c:\Leo_Exe_Path.txt file to build the python command line. Leo_Exe_Path.txt is just a substitute for setting and reading an environment variable. Environment variables are difficult to do in Windows XP.

The batch files should contain the following commands:


@echo off

rem Get Leo source to execute (Set by Leo_Set-xxx.bat)

set /p Leo_Exe= < C:\Leo_Exe_Path.txt

echo Leo: %Leo_Exe%

rem Change to Python directory (Modify path based on installation)

cd "C:\Program Files\Python"

cmd /C pythonw "%Leo_Exe%" %1


Rem Specify which Leo source to execute (used by Leo.bat)

echo C:\Program Files\Leo\src\ > c:\Leo_Exe_Path.txt

Double click on a Leo_Set-???.bat file or execute it from a command line to set the Leo branch to use. Double click on a .Leo file to open it in Leo using the branch. Be sure to associate the Leo.bat files to the '.leo' extension as described above.


  • You can remove this functionality by Reassigning the "Open With..." application back to 'pythonw'.
  • The Leo.bat file leaves a dos command window open. Just click on the windows close icon to close it. Leo will remain running. Otherwise, the dos command window will close automatically when Leo is closed.