Advertisement
Guest User

tcbat

a guest
Jun 15th, 2011
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2.  
  3. :: These lines followed by two colons are comments. Please read them carefully.
  4.  
  5. :: Before you proceed, add your TrueCrypt volume(s) to "Favorites". Otherwise the parameters below won't work.
  6.  
  7. :: If you need help with adding TrueCrypt volume(s) to "Favorites", please refer to TrueCrypt user manual.
  8.  
  9. :: Do not check 'Mount selected volume upon logon', or any of the other options around it.
  10.  
  11. :: The user is required to enter the TrueCrypt password manually, as always, so the password will not be stored in a command file anywhere.
  12.  
  13. :: Except for entry of the TrueCrypt password, everything happens automatically when a user logs on.
  14.  
  15. :: The script which does the work will simply wait for the TrueCrypt volume to be mounted, then do the sharing.
  16.  
  17. :: Windows Vista User Account Control (UAC) need not be disabled or modified.
  18.  
  19. :: Only simple batch commands using CMD.exe are required - no other scripting language.
  20.  
  21. :: There are no "tricks," no changes to the registry, no use of undocumented commands.
  22.  
  23. title Mount TrueCrypt Volume(s)
  24.  
  25. echo ENTER PASSWORD into TrueCrypt.....
  26.  
  27. :: Set path to "TrueCrypt.exe"
  28.  
  29. :: Only change what is between quotes if path to your "TrueCrypt.exe" differs from the one below.
  30.  
  31. :: For example, in a 64-bit installation the path would be "C:\Program Files\TrueCrypt\TrueCrypt.exe"
  32.  
  33. :: Please keep the parameters after the quotes unchanged.
  34.  
  35. @ "C:\Program Files (x86)\TrueCrypt\TrueCrypt.exe" /auto favorites /quit
  36.  
  37. :: The following code mounts your shared folder
  38.  
  39. :: This is how the commands "NET SHARE" work...
  40.  
  41. :: NET SHARE [share name]=[path] /GRANT:[user],[permission]
  42.  
  43. :: Note- The square brackets [] are for reference only, and should not be used in main commands.
  44.  
  45. :: [share name] can be any name you give to your particular shared folder.
  46.  
  47. :: [path] is the path to that folder.
  48.  
  49. :: [user] can be windows user name(s), or EVERYONE for the folder to be accessible to everyone.
  50.  
  51. :: [permission] can be FULL for full access, READ for read-only access, etc.
  52.  
  53. :: Important: If the [share name] or [path] contain space or special characters, put them between quotes. For example: "[share name]=[path]"
  54.  
  55. :: That is it for the batch command part. Save the file as [filename].bat; for example- truecrypt.bat
  56.  
  57. :: Follow the instructions bellow to add this batch file to windows startup...
  58.  
  59. :: Launch the Task Scheduler.
  60.  
  61. :: Create a new task.
  62.  
  63. :: Select an Admin account, run only when user is logged on, highest privileges.
  64.  
  65. :: Trigger at logon, all users (or a specific user), "enabled."
  66.  
  67. :: Start a program, browse for your script Whatever.cmd (or .bat)
  68.  
  69. :: Run as soon as possible if scheduled start is missed.
  70.  
  71. :: The command lines for two shared folders may look something like this...
  72.  
  73. NET SHARE Pics=D:\Pictures /GRANT:EVERYONE,FULL
  74.  
  75. NET SHARE "My Documents=D:\My Documents" /GRANT:EVERYONE,READ
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement