Advertisement
Guest User

Untitled

a guest
Sep 17th, 2017
84
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 caefully.
  4. :: Before you proceed, add your TrueCrypt volume(s) to "Favorites". Otherwise the parameters below won't work.
  5. :: If you need help with adding TrueCrypt volume(s) to "Favorites", please refer to TrueCrypt user manual.
  6. :: The user is required to enter the TrueCrypt password manually, as always, so the password will not be stored in a command file anywhere.
  7. :: Except for entry of the TrueCrypt password, everything happens automatically when a user logs on.
  8. :: The script which does the work will simply wait for the TrueCrypt volume to be mounted, then do the sharing.
  9. :: Windows Vista User Account Control (UAC) need not be disabled or modified.
  10. :: Only simple batch commands using CMD.exe are required - no other scripting language.
  11. :: There are no "tricks," no changes to the registry, no use of undocumented commands. Well, just one small one.
  12.  
  13. title Mount TrueCrypt Volume(s)
  14. echo ENTER PASSWORD into TrueCrypt.....
  15.  
  16. :: Set path to "TrueCrypt.exe"
  17. :: Only change what is between quotes if path to your "TrueCrypt.exe" differs from the one below.
  18. :: For example, in a 64-bit installation the path would be "C:\Program Files\TrueCrypt\TrueCrypt.exe"
  19. :: Please keep the parameters after the quotes unchanged.
  20. @ "C:\Program Files (x86)\TrueCrypt\TrueCrypt.exe" /auto favorites /quit
  21.  
  22. :: The following code mounts your shared folder
  23. :: This is how the commands "NET SHARE" work...
  24. :: NET SHARE [share name]=[path] /GRANT:[user],[permission]
  25. :: Note- The square brackets [] are for reference only, and should not be used in main commands.
  26. :: [share name] can be any name you give to your particular shared folder.
  27. :: [path] is the path to that folder.
  28. :: [user] can be windows user name(s), or EVERYONE for the folder to be accessible to everyone.
  29. :: [permission] can be FULL for full access, READ for read-only access, etc.
  30. :: Important: If the [share name] or [path] contain space or special characters, put them between quotes. For example: "[share name]=[path]"
  31. :: That is it for the batch command part. Save the file as [filename].bat; for example- truecrypt.bat
  32. :: Follow the instructions bellow to add this batch file to windows startup...
  33. :: Launch the Task Scheduler.
  34. :: Create a new task.
  35. :: Select an Admin account, run only when user is logged on, highest privileges.
  36. :: Trigger at logon, all users (or a specific user), "enabled."
  37. :: Start a program, browse for your script Whatever.cmd.
  38. :: Run as soon as possible if scheduled start is missed.
  39.  
  40. :: The command lines for two shared folders may look something like this...
  41. NET SHARE Pics=D:\Pictures /GRANT:EVERYONE,FULL
  42. NET SHARE "My Documents=D:\My Documents" /GRANT:EVERYONE,READ
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement