Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like my TrueCrypt virtual drive to act as a newly inserted USB drive or CD/DVD by executing commands in the partition's autorun.inf file.

I've read several suggestions online including creating a .bat file or installing software so Windows will think this is a CD, but I'd like to know the easiest and least intrusive way to pull it off. i.e. I want to keep from installing or messing with the host computer as much as possible, as this is intended to be a fully portable drive.

EDIT: To clarify, I technically have TWO separate autorun.inf files on my flash drive: there is one in the base directory of the USB drive which correctly prompts me to run TrueCrypt as soon as I insert the drive, and there is a second autorun.inf that is inside the encrypted container.

The second autorun.inf file resides in the base directory of the virtual drive created after TrueCrypt mounts (actually, this inf file was created by LiberKey, which is the portable UI I'm using inside the container). I would like to be able to autorun this second inf file as soon as the virtual drive is mounted.

share|improve this question

3 Answers 3

up vote 0 down vote accepted

There is an answer here:

http://www.ericsprojects.com/?p=102

Seems to be an easy way to do it. Just create a file, place the code from article into it and modify drive letter if needed. Shouldn't take more than 5 minutes.

share|improve this answer
1  
Although this information is helpful for those who may have autorun issues after inserting the USB drive, my question is actually concerning what happens AFTER the drive has been inserted and TrueCrypt has mounted the virtual drive. –  NoCatharsis Mar 15 '10 at 19:23

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
share|improve this answer

Microsoft has a utility (aka "PowerToy") for Windows called TweakUI that allows you to enable or disable autoplay on your drives (under My Computer | Autoplay | Drives in the left pane of the TweakUI program). I just mounted a TrueCrypt volume and it's visible in TweakUI -- so it looks like I could autoplay on enable it). Sorry I can't test it further because I don't have an autorun.inf file to play with).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.