Update: Please do not use TrueCrypt anymore. Development of TrueCrypt was discontinued a while ago due to numerous security flaws detected in the core part. In fact, TrueCrypt is not secure and you should switch as soon as possible. Luckily, there are a couple of viable alternative solutions available. Thanks to Comparitech for the heads-up on this rather old post. They have provided a list of viable free TrueCrypt alternatives for you to choose from. Enjoy!
TrueCrypt represents a
viable solution to easily setup encryption for files, folder or even entire drives on Windows 7/Vista/XP, Mac OS X, and Linux.
Sometimes you might want your encrypted drive(s) to be automatically (re-)mounted when Windows starts. Fortunately, this can be easily achieved with a batch file and Window’s built-in Task Planner, as shown below:
@echo OFF echo Mounting encrypted drive.. "C:\Program Files\TrueCrypt\truecrypt.exe" /v \Device\Harddisk1\Partition1 /l i /c /p "your_password" /q /m rm /w echo Done!
Please note that in this example the password will be included in plaintext in the batch file, which might pose a security risk. Although there are more secure solutions available (e.g. have a look at the cache option) this example only serves demonstrational purposes.
For a list of all command line options please refer to the Command Line Usage page.