How do I autorun applications after mounting a TrueCrypt container?

I know this question is old, but it is high on the search listing so I though I would post my solution.

I mount the disk and launch my programs using a .bat file. I launch the .bat file in scheduled tasks "at logon".

Here is my bat. Enjoy.

Note, you should set truecrypt to not automatically mount your "favourites" and there is a situtation that the following bat does not handle: When a volume is mounted to an alternate drive letter than specified.


REM - Truecrypt mount and launch file - 2013
REM - Set variables as needed below
@ECHO OFF

SET tcexec="%PROGRAMFILES%\truecrypt\truecrypt.exe"
SET mountdrive=x
SET volumefolder="%USERPROFILE%\truecrypt"
SET volumename=TrueCrypt-Volume

IF EXIST %mountdrive%: goto DriveExists

IF NOT EXIST %volumefolder%\%volumename% goto NoVolume

IF NOT EXIST %tcexec% goto noTC

REM Mount volume
cd %volumefolder%
%tcexec% /v %volumename% /l%mountdrive% /a /q
echo %ERRORLEVEL%
if ERRORLEVEL 1 GOTO mountfail
if ERRORLEVEL 0 GOTO startprograms

:startprograms
REM ******************************
REM ** Start your programs here **
REM ******************************
REM start "" "C:\Users\<userid>\AppData\Roaming\AeroFSExec\aerofs.exe"
REM start "" "C:\Program Files\ownCloud\owncloud.exe"

REM ********************************
REM ** END of Program Start block **
REM ********************************

goto end

:mountfail
echo Truecrypt failed to mount volume.
goto end

:noTC
echo Cant find truecrypt at: %tcexec%
goto end

:NoVolume
echo Identified volume does not exist: %volumefolder%\%volumename%
goto end

:DriveExists
echo Drive letter %mountdrive% already exists, cannot mount truecrypt volume
goto end

:End