Making a Portable TortoiseHG

TortoiseHG is borked at work, so (at home) I made a script to build a portable version of it.


: clean up anything we may have had leftover
IF EXIST %~dp0portable-thg RD /S /Q %~dp0portable-thg
IF EXIST %~dp0msidump RD /S /Q %~dp0msidump

: make a pair of folders
MKDIR %~dp0portable-thg
MKDIR %~dp0msidump

: dump the tortoisehg tool
msiexec /a tortoisehg-5.9.2-x64.msi /qb TARGETDIR=%~dp0msidump

: copy the files
xcopy /S %~dp0msidump\PFiles\TortoiseHg %~dp0portable-thg

: create the bat file
ECHO SET PATH=%%~dp0;%%PATH%% > portable-thg\portable-thg.bat
ECHO %%~dp0thgw.exe >> portable-thg\portable-thg.bat

You’ll need the 5.9.2 x64 installer, or whatever is current. Put it in the same folder as the batch file above, run the batch file, and the portable-thg/ has your application.

Launch it with portable-thg.bat … once you’ve copied it to where you need it. It’s about 83mb on disk and 24mb compressed - so I’m keeping a copy of it in my Google Drive.

comments powered by Disqus
Peter LaValle avatar
Peter LaValle
Any links probably include affiliate ids for that sweet sweet kickback - and some programs require that I tell you. The contents of this blog are likely unrelated - as they include games, paints, and build tools.