Apr 15

I found a great article about a script to mount a TrueCrypt Volume on Windows here.  It also detailed a script to unmount the volume.

I decided to improve on it a bit, and allow the same script to mount and unmount the volume (by testing to see if the volume is mounted).  I did not include his password parameter because TrueCrypt will ask for the password anyway. And I really don’t want to code my password into any script.

So here is the script:

REM TrueCrypt mounting script (version 2)
REM Based on script Written by Mark Ursino (allthingsmarked.com)
REM Modified by Zen (Zenmojo.com)
REM Modifications are allowed, but please include these comments
@echo off

set TrueSource=I:\TrueCrypt\truecrypt
set Source=I:\volume.cab
set Drive=O:

IF EXIST “%Drive%” goto unmount

:mount
cls
“%TrueSource%” /v “%Source%” /l “%Drive%” /m /a /p /q
explorer.exe “%Drive%”
cls
goto end

:unmount
cls
“%TrueSource%” /d”%Drive%” /q
cls
goto end

:end
cls

Notes:
TrueSource is the location of your truecrypt.sys file (from the stand-alone version of TrueCrypt)
Source is the source of your TrueCrypt file
Drive is the drive letter you want to mount the file to

Share