Jan Costermans - 2011-04-17

LAYOUT of portable folder, I have called mine TOOLS

ANY_DRIVE_AND_SUBFOLDER\TOOLS  
ANY_DRIVE_AND_SUBFOLDER\TOOLS\setENV.bat

This is the file you should run to start console because it sets the path variable so everything works ok. It looks like this:

@ECHO OFF
REM SETTINGS FOR THE TOOLS
REM PATH ENVIRONMENT
REM get Script directory (this is the folder where this bat file is in)
Set scriptDir=%~dp0%
ECHO %scriptDir%
REM add the folders of the portable tools to the path (if you want to be able to run them from console)
Set toolPaths=%scriptDir%Mercurial;%scriptDir%R;%scriptDir%Python;%scriptDir%SumatraPDF;%scriptDir%7zip;%scriptDir%wget;%scriptDir%hfs;%scriptDir%w3m
REM add addtional locations to the path
Set addPath=%scriptDir%
PATH=%toolPATHS%;%PATH%;%addPath%
REM get drive name (letter)
set drive=%cd:~0,3%
REM Change to drive
%cd:~0,2%
cd..
ECHO Changed to drive %drive%
REM cd %cd:~0,3%TOOLS\Console2
start %cd:~0,3%TOOLS\Console2\Console.exe
ECHO Closing CMD and opening Console2
exit

ANY_DRIVE_AND_SUBFOLDER\TOOLS\Console2\console.xml looks like this:

<?xml version="1.0"?>
<settings>
    <console change_refresh="10" refresh="100" rows="39" columns="102" buffer_rows="5000" buffer_columns="0" shell="" init_dir="" save_size="1" start_hidden="0">
        <colors>
            <color id="0" r="0" g="0" b="0"/>
            <color id="1" r="0" g="0" b="128"/>
            <color id="2" r="0" g="150" b="0"/>
            <color id="3" r="0" g="150" b="150"/>
            <color id="4" r="170" g="25" b="25"/>
            <color id="5" r="128" g="0" b="128"/>
            <color id="6" r="128" g="128" b="0"/>
            <color id="7" r="192" g="192" b="192"/>
            <color id="8" r="128" g="128" b="128"/>
            <color id="9" r="0" g="100" b="255"/>
            <color id="10" r="0" g="255" b="0"/>
            <color id="11" r="0" g="255" b="255"/>
            <color id="12" r="255" g="50" b="50"/>
            <color id="13" r="255" g="0" b="255"/>
            <color id="14" r="255" g="255" b="0"/>
            <color id="15" r="255" g="255" b="255"/>
        </colors>
    </console>
    <appearance>
        <font name="MiscFixedSC613" size="12" bold="0" italic="0" smoothing="2">
            <color use="0" r="255" g="255" b="255"/>
        </font>
        <window title="Console" icon="" use_tab_icon="1" use_console_title="0" show_cmd="1" show_cmd_tabs="1" use_tab_title="1" trim_tab_titles="25" trim_tab_titles_right="0"/>
        <controls show_menu="1" show_toolbar="0" show_statusbar="0" show_tabs="1" hide_single_tab="1" show_scrollbars="1" tabs_on_bottom="0" flat_scrollbars="0"/>
        <styles caption="1" resizable="1" taskbar_button="0" border="0" inside_border="1" tray_icon="1">
            <selection_color r="255" g="255" b="255"/>
        </styles>
        <position x="108" y="9" dock="-1" snap="-1" z_order="0" save_position="1"/>
        <transparency type="1" active_alpha="230" inactive_alpha="205" r="0" g="0" b="0"/>
    </appearance>
    <behavior>
        <copy_paste copy_on_select="1" clear_on_copy="1" no_wrap="1" trim_spaces="1" copy_newline_char="0"/>
        <scroll page_scroll_rows="0"/>
        <tab_highlight flashes="3" stay_highligted="1"/>
    </behavior>
    <hotkeys use_scroll_lock="1">
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="83" command="settings"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="112" command="help"/>
        <hotkey ctrl="0" shift="0" alt="1" extended="0" code="115" command="exit"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="112" command="newtab1"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="113" command="newtab2"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="114" command="newtab3"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="115" command="newtab4"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="116" command="newtab5"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="117" command="newtab6"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="118" command="newtab7"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="119" command="newtab8"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="120" command="newtab9"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="121" command="newtab10"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="49" command="switchtab1"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="50" command="switchtab2"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="51" command="switchtab3"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="52" command="switchtab4"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="53" command="switchtab5"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="54" command="switchtab6"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="55" command="switchtab7"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="56" command="switchtab8"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="57" command="switchtab9"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="48" command="switchtab10"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="9" command="nexttab"/>
        <hotkey ctrl="1" shift="1" alt="0" extended="0" code="9" command="prevtab"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="87" command="closetab"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="0" code="82" command="renametab"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="1" code="45" command="copy"/>
        <hotkey ctrl="1" shift="0" alt="0" extended="1" code="46" command="clear_selection"/>
        <hotkey ctrl="0" shift="1" alt="0" extended="1" code="45" command="paste"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="stopscroll"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollrowup"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollrowdown"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollpageup"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollpagedown"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollcolleft"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollcolright"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollpageleft"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollpageright"/>
        <hotkey ctrl="1" shift="1" alt="0" extended="0" code="112" command="dumpbuffer"/>
        <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="activate"/>
    </hotkeys>
    <mouse>
        <actions>
            <action ctrl="0" shift="0" alt="0" button="0" name="copy"/>
            <action ctrl="0" shift="0" alt="0" button="1" name="select"/>
            <action ctrl="0" shift="0" alt="0" button="2" name="paste"/>
            <action ctrl="1" shift="0" alt="0" button="1" name="drag"/>
            <action ctrl="0" shift="0" alt="0" button="3" name="menu"/>
        </actions>
    </mouse>
    <tabs>
        <tab title="CMD" use_default_icon="0">
            <console shell="" init_dir="" run_as_user="0" user=""/>
            <cursor style="0" r="255" g="255" b="255"/>
            <background type="0" r="0" g="0" b="0">
                <image file="" relative="0" extend="0" position="0">
                    <tint opacity="0" r="0" g="0" b="0"/>
                </image>
            </background>
        </tab>
        <tab title="R" icon="R.ico" use_default_icon="0">
            <console shell=".\TOOLS\R\bin\R.exe" init_dir="c:\" run_as_user="0" user=""/>
            <cursor style="0" r="255" g="255" b="0"/>
            <background type="0" r="0" g="0" b="0">
                <image file="" relative="0" extend="0" position="0">
                    <tint opacity="0" r="0" g="0" b="0"/>
                </image>
            </background>
        </tab>
        <tab title="Python 3.1" icon="python-crystal.ico" use_default_icon="0">
            <console shell=".\TOOLS\Python\python.exe" init_dir="c:\" run_as_user="0" user=""/>
            <cursor style="0" r="255" g="255" b="0"/>
            <background type="0" r="0" g="0" b="0">
                <image file="" relative="0" extend="0" position="0">
                    <tint opacity="0" r="0" g="0" b="0"/>
                </image>
            </background>
        </tab>
        <tab title="Cygwin" use_default_icon="0">
            <console shell="cmd.exe /k .\TOOLS\cygwin\Cygwin.bat" init_dir="" run_as_user="0" user=""/>
            <cursor style="0" r="255" g="255" b="255"/>
            <background type="0" r="0" g="0" b="0">
                <image file="" relative="0" extend="0" position="0">
                    <tint opacity="0" r="0" g="0" b="0"/>
                </image>
            </background>
        </tab>
    </tabs>
</settings>

As you can see, I have also added a tab for a python console and an R console (statistics package), these are located in:
ANY_DRIVE_AND_SUBFOLDER\TOOLS\Python
ANY_DRIVE_AND_SUBFOLDER\TOOLS\R

I installed cygwin in C:\ and copied the entire folder to the TOOLS folder
ANY_DRIVE_AND_SUBFOLDER\TOOLS\Cygwin

I modified the bat file :
ANY_DRIVE_AND_SUBFOLDER\TOOLS\Cygwin\Cygwin.bat so it looks like:

@ECHO OFF
REM SETTINGS FOR THE TOOLS
REM PATH ENVIRONMENT
REM get Script directory (this is the folder where this bat file is in)
Set scriptDir=%~dp0%
ECHO %scriptDir%
Set addPath=%scriptDir%bin
PATH=%PATH%;%addPath%
REM get drive name (letter)
set drive=%cd:~0,3%
REM Change to drive
%cd:~0,2%
set SHELL=/bin/bash
set CYGWIN=codepage:437
set HOME=/home/CAJAC
cd TOOLS
cd cygwin
cd bin
mount -f %scriptDir%/ /cygdrive/
mount -f %scriptDir%bin /cygdrive/usr/bin
mount -f %scriptDir%lib /cygdrive/usr/lib
bash --login -i

That's it basically.

I also added a bunch of additonal portable apps in the Tools folder (the paths to command line tools are added in the setENV.bat file)
my tools include (I mention these here just as a recommendation):
- 7zip command line version
- mercurial
- hfs (http file server)
- Sumatra PDF
- Keepass
- notepad++
- …