Guest
Public paste!

azulmarino

By: a guest | Dec 2nd, 2008 | Syntax: None | Size: 3.48 KB | Hits: 154 | Expires: Never
Copy text to clipboard
  1. @echo off
  2. :: This batch file will create an HTML Application (HTA).
  3. :: Values entered in the HTA will be saved as %TEMP%\USERIN.BAT
  4. :: After the USERIN.BAT is CALLed from the main batch
  5. :: (and assuming there is enough room in the environment)
  6. :: environmental variables USERNAME and PASSWORD will be set.
  7. :: It is your responsibility to delete the USERIN.BAT
  8. :: after you CALL it. Because this batch file needs to
  9. :: find itself, you must be sure to call it from your
  10. :: main batch file with a full path and file name.
  11. :: Written and tested under Win95. NT/2000/XP users will
  12. :: have to do some modifications before it will work.
  13. :: For example, %0 changes to %f0
  14. :: Public Domain. Use freely. No guarantees! It may not work!
  15. :: Adapted from this script: http://www.ericphelps.com/batch/samples/hta_password.bat.txt
  16.  
  17. cls
  18. echo Please enter your password in the entry box...
  19. :: See if I can find myself
  20. If not exist %0 goto ERROR
  21. :: Make the web page
  22. type %0 | find "    " | find /v "Not Me!" > %TEMP%\UserIn.hta
  23. :: Run the vbs code
  24. start /w %TEMP%\UserIn.hta
  25. :: At this point a batch file "%TEMP%\UserIn.bat" exists and you should
  26. :: call it! If you don't call the batch file here and instead opt to
  27. :: call it from another batch file, be sure NOT to delete it in the
  28. :: "Clean up" code section below!
  29. call %TEMP%\UserIn.bat
  30.  
  31. :: Mount encrypted partitions:
  32. :: Music
  33. "C:\Program Files\TrueCrypt\TrueCrypt.exe" /v \Device\Harddisk1\Partition4 /lf /p %PASSWORD% /s /q
  34. :: Pix
  35. "C:\Program Files\TrueCrypt\TrueCrypt.exe" /v \Device\Harddisk1\Partition5 /lg /p %PASSWORD% /s /q
  36. :: Videos
  37. "C:\Program Files\TrueCrypt\TrueCrypt.exe" /v \Device\Harddisk1\Partition3 /lh /p %PASSWORD% /s /q
  38. :: BkDyn
  39. "C:\Program Files\TrueCrypt\TrueCrypt.exe" /v \Device\Harddisk0\Partition2 /lk /p %PASSWORD% /s /q
  40.  
  41. :: Set up shared folders in unencrypted partitions:
  42. net share Music=F:\Music /GRANT:rojomojo,FULL
  43. net share NewMusic=F:\NEWmusic /GRANT:rojomojo,FULL
  44. net share Pictures=G:\Pictures /GRANT:rojomojo,FULL
  45. net share Videos=H:\Videos /GRANT:rojomojo,FULL
  46. net share Tempo=I:\ /GRANT:rojomojo,FULL
  47.  
  48. :: Play Chime
  49. "C:\Program Files\K-Lite Codec Pack\Media Player Classic\mplayerc.exe" C:\Users\rojomojo\Music\Sounds\chimes\30601_acclivity_Goblet_F_Soft.wav /play /minimized /close
  50.  
  51. :: Clean up
  52. del %TEMP%\UserIn.hta
  53. del %TEMP%\UserIn.bat
  54. goto DONE
  55.  
  56. :ERROR
  57. cls
  58. echo %0 is not the full path and file name
  59. echo for the batch file. You MUST call this
  60. echo batch file with a full path and file name.
  61. goto DONE
  62.  
  63. :HTA
  64. :: All HTA code MUST be indented four or more spaces.
  65. :: NOTHING else in this batch file may be indented four spaces.
  66.     <html>
  67.     <head>
  68.     <title>Hey!</title>
  69.     <hta:application>
  70.     <script language="vbscript">
  71.         window.resizeTo 250,135
  72.         Sub SaveBatch()
  73.             Set fs = CreateObject("Scripting.FileSystemObject")
  74.             strFile = fs.GetAbsolutePathName(fs.BuildPath(fs.GetSpecialFolder(2), "UserIn.bat"))
  75.             Set ts = fs.OpenTextFile(strFile, 2, True)
  76.             ts.WriteLine "SET PASSWORD=" & document.Forms(0).elements("password").value
  77.             ts.Close
  78.         End Sub
  79.     </script>
  80.     </head>
  81.     <body>
  82.     <form>
  83.         Watz up?
  84.         <br><input type=password name=password>
  85.         <br><input type=button language="vbscript" value="OK"
  86.         onclick="SaveBatch : Window.Close">
  87.     </form>
  88.     <script language=vbscript>
  89.         document.Forms(0).elements("password").focus
  90.     </script>
  91.     </body>
  92.     </html>
  93.  
  94. :DONE