0

how do i get a batch script to wait for TrueCrypt to successfully mount, before moving on w/the script?

i.e., i would like run a single batch script that would a) mount a volume, b) wait for user to input correct password, c) run a program on the encrypted volume

i.e., none of these work in my batch script:

truecrypt /vfile.tc /lx

start "" /b /wait truecrypt /vfile.tc /lx

start "" /wait /b truecrypt /vfile.tc /lx

start "" /wait /b batchWithTrueCryptMountCmds.bat

call schtasks /RUN /TN myTrueCryptTask

call truecrypt /vfiletc /lx

etc.

any help?

atreyu
  • 362

1 Answers1

1

If you know the TrueCrypt drive letter, then possibly something like this:

:no
rem ping for pause (2 sec)
PING 127.0.0.1 -n 2 || PING ::1 -n 2

rem check drive is mounted
IF EXIST T:\ (GOTO yes) ELSE (GOTO no)
:yes

Also see http://www.robvanderwoude.com/wait.php for alternative methods for adding a pause in the batch file. You don'y necessarily need the pause section, but without it you'll end up burning more CPU than necessary checking if the drive is ready. Also discussed here: https://stackoverflow.com/questions/1672338/how-to-sleep-for-5-seconds-in-windowss-command-prompt-or-dos

Check for drive discussed here: https://stackoverflow.com/questions/24060404/check-if-drive-letter-exists-in-batch-or-else-goto-another-piece-of-code

Sir Adelaide
  • 4,977
  • 2
  • 16
  • 36