Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- :: These lines followed by two colons are comments. Please read them carefully.
- :: Before you proceed, add your TrueCrypt volume(s) to "Favorites". Otherwise the parameters below won't work.
- :: If you need help with adding TrueCrypt volume(s) to "Favorites", please refer to TrueCrypt user manual.
- :: Do not check 'Mount selected volume upon logon', or any of the other options around it.
- :: The user is required to enter the TrueCrypt password manually, as always, so the password will not be stored in a command file anywhere.
- :: Except for entry of the TrueCrypt password, everything happens automatically when a user logs on.
- :: The script which does the work will simply wait for the TrueCrypt volume to be mounted, then do the sharing.
- :: Windows Vista User Account Control (UAC) need not be disabled or modified.
- :: Only simple batch commands using CMD.exe are required - no other scripting language.
- :: There are no "tricks," no changes to the registry, no use of undocumented commands.
- title Mount TrueCrypt Volume(s)
- echo ENTER PASSWORD into TrueCrypt.....
- :: Set path to "TrueCrypt.exe"
- :: Only change what is between quotes if path to your "TrueCrypt.exe" differs from the one below.
- :: For example, in a 64-bit installation the path would be "C:\Program Files\TrueCrypt\TrueCrypt.exe"
- :: Please keep the parameters after the quotes unchanged.
- @ "C:\Program Files (x86)\TrueCrypt\TrueCrypt.exe" /auto favorites /quit
- :: The following code mounts your shared folder
- :: This is how the commands "NET SHARE" work...
- :: NET SHARE [share name]=[path] /GRANT:[user],[permission]
- :: Note- The square brackets [] are for reference only, and should not be used in main commands.
- :: [share name] can be any name you give to your particular shared folder.
- :: [path] is the path to that folder.
- :: [user] can be windows user name(s), or EVERYONE for the folder to be accessible to everyone.
- :: [permission] can be FULL for full access, READ for read-only access, etc.
- :: Important: If the [share name] or [path] contain space or special characters, put them between quotes. For example: "[share name]=[path]"
- :: That is it for the batch command part. Save the file as [filename].bat; for example- truecrypt.bat
- :: Follow the instructions bellow to add this batch file to windows startup...
- :: Launch the Task Scheduler.
- :: Create a new task.
- :: Select an Admin account, run only when user is logged on, highest privileges.
- :: Trigger at logon, all users (or a specific user), "enabled."
- :: Start a program, browse for your script Whatever.cmd (or .bat)
- :: Run as soon as possible if scheduled start is missed.
- :: The command lines for two shared folders may look something like this...
- NET SHARE Pics=D:\Pictures /GRANT:EVERYONE,FULL
- NET SHARE "My Documents=D:\My Documents" /GRANT:EVERYONE,READ
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement