This article will show you how to use the power of a Windows batch script to mount a TrueCrypt volume and explore the contents as a hard drive in just one step. For those of you that don’t know, TrueCrypt is free software that you can use to encrypt files. You can create a container file (named anything you want) and mount it as a drive using the TrueCrypt software. Unmounted, it looks just like a regular file.
Create your volume
Create any size TrueCrypt volume using your encryption algorithm of choice. My computer runs the Blowfish algorithm the fastest, so that’s my typical choice. Make sure you assign a good, long, hard-to-break password to it. The only way to reveal the contents of the volume is the password. We’re talking encryption standards the government uses here. So no one’s going to break in another way — you need a good password and you must remember it.
Copy TrueCrypt stand-alone files
TrueCrypt comes in an installable version and an stand-alone version. You can use the stand-alone command-only version for the batch script. The stand-alone files are inside the “Setup Files” folder inside the TrueCrypt folder. Go ahead and copy truecrypt.sys
and truecrypt-x64.sys
to C:\WINDOWS\
. This will allow us to call the TrueCrypt program in the batch script.
Create a script to mount
You may download a batch script I wrote to mount a volume. Make sure you fill in the appropriate parts specific to you. These parts are capitalized to stand out. Place this script in C:\WINDOWS\
so you can call it from the Run box. Here’s the main line in the script:
tc /v <path to file> /l x /p <your password> /q
Make sure you fill in the correct path to your file, and the appripriate password you’ve chosen. You may notice, I use various flags in the call. The /v
flag will make TC mount a volume; then /l x
will mount it as the letter X:\ (like it’s a drive); /p
means the password follows it. Finally, /q
will quit the program. After the mounting takes place, we call explorer on the X:\ drive to open it.
Create a script to unmount
Following the previous script’s example, I’ve also written a script to unmount your volume. Fill in the necessary changes. Place this script in C:\WINDOWS\
so you can call it from the Run box. The only new flag I use is /dx
which will dismount the X:\ drive.
Test it out
Time to test it all out. Hit WinKey + R
> type in mount
and hit Enter. Your volume should mount and should open in Windows Explorer. Now, to unmount it, in the Run box, type in unmount
and hit Enter. Nextel. Done.
Also, you can rename the batch scripts to something only you will know, so it’s not easy to mount on your computer. For example, change mount.bat
and unmount.bat
to something like xy33.bat
and sysz.bat
. Only you will know.
so now point me in the direction to running a “secure” batch file so that putting your password in a text file on the same pc as the TC volume, is not neccessary
T3k,
You can also choose to NOT include the password in the file, and instead require the password via input to the script.
E.g.
mount Mypa55w0rd
Where Mypa55w0rd is taken as input into the script. I will write a follow-up to this article using that method.
It’s a great idea! How would you do it so that you need to input the password, I am very curious
I have revisited this topic and a follow-up article is available with extra security features. Please visit the new article for the latest material for this method.