Код:
Option Explicit
Dim strContainerFile
Dim strPath2TrueCrypt
Dim strDriveLetter
If WScript.Arguments.Count = 1 Then
strContainerFile = WScript.Arguments.Item(0)
With WScript.CreateObject("Scripting.FileSystemObject")
If .FileExists(strContainerFile) Then
strPath2TrueCrypt = .BuildPath(WScript.CreateObject("Shell.Application").NameSpace("shell:ProgramFiles").self.Path, "TrueCrypt\TrueCrypt.exe")
If .FileExists(strPath2TrueCrypt) Then
strDriveLetter = .GetBaseName(strContainerFile) & ":"
If Not .DriveExists(strDriveLetter) Then
WScript.CreateObject("WScript.Shell").Run """" & strPath2TrueCrypt & """ /letter " & strDriveLetter & " /volume """ & strContainerFile & """ /history n /cache n /mountoption removable /quit", 1, False
Else
WScript.CreateObject("WScript.Shell").Run """" & strPath2TrueCrypt & """ /dismount " & strDriveLetter & " /wipecache /silent /quit", 1, False
End If
Else
WScript.Echo "Can't find [" & strPath2TrueCrypt & "]."
WScript.Quit 3
End If
Else
WScript.Echo "Can't find TrueCrypt container file [" & strContainerFile & "]."
WScript.Quit 2
End If
End With
Else
WScript.Echo "Usage: " & WScript.ScriptName & " <TrueCrypt container file>"
WScript.Quit 1
End If
WScript.Quit 0