Skip to content

Instantly share code, notes, and snippets.

@psrdotcom
Created August 8, 2019 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psrdotcom/8350f1469a7a396a886e86b3f29ef38a to your computer and use it in GitHub Desktop.
Save psrdotcom/8350f1469a7a396a886e86b3f29ef38a to your computer and use it in GitHub Desktop.
Truecrypt Mount and Unmount in Windows Batch file
@echo off
set TrueSource=E:\ProgramFiles\TrueCrypt\truecrypt
set Source=E:\ProgramFiles\TrueCrypt\test
set Drive=P:
set KeyFile=E:\ProgramFiles\TrueCrypt\keyfile1
set Password=abcd1234ABCD!@#$
set BrowserPath="C:\Program Files (x86)\Internet Explorer\iexplore.exe"
set WebSite=ELS
set URL="http://localhost:86"
set PATH=%PATH%;C:\Windows\System32\inetsrv
echo %PATH%
IF EXIST %Drive% goto unmount
:mount
cls
%TrueSource% /v %Source% /l %Drive% /m /a /k %KeyFile% /p %Password% /q
REM explorer.exe %Drive%
cls
net start wmsvc
appcmd start apppool /apppool.name:%WebSite%
appcmd start site /site.name:%WebSite%
%BrowserPath% %URL%
goto end
:unmount
cls
%TrueSource% /d %Drive% /f /s /q
appcmd stop site /site.name:%WebSite%
appcmd stop apppool /apppool.name:%WebSite%
net stop wmsvc
cls
goto end
:end
cls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment