Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. cd
  2. cd c:lighthouse
  3. mv production.exe production_old.exe /Y
  4. cd
  5. cd c:productionbackup
  6. cd
  7. xcopy "c:productionbackupproduction.exe" "c:lighthouseproduction.exe" /Y
  8. xcopy "c:productionbackupproduction.exe" "i:production.exe" /Y
  9. xcopy "c:productionbackupproduction.exe" "c:RAR_and_Mailproduction.exe" /Y
  10. cd
  11.  
  12. cd
  13. cd c:RAR_and_Mail
  14. xcopy "c:RAR_and_Mail*.rar" "c:RAR_and_Mailold*.rar" /Y
  15. del c:RAR_and_Mail*.rar
  16. set MyDate=%date:/=.%.%
  17. set WINRAR=C:Program FilesWinRARrar.exe
  18. set production=c:RAR_and_mail
  19. cd /D %production%
  20. "%WINRAR%" a -r -s -m5 /Y /R "%production%%MyDate%_production.rar" "*.exe"
  21. cd
  22. call c:batchesSendMail_Executable.bat
  23.  
  24. echo off
  25. set MyDate=%date:/=.%.%
  26. c:sendmailsendEmail -o tls=no -f test@mail.com -t test@mail.com -s 254.20.10.100:25 -u "Latest work Update" -a "c:RAR_and_Mail%MyDate%_production.rar" -m "'Save As' the attachement, go to folder where it was saved, and 'extract here', overwriting existing production.exe."
  27.  
  28. $FilePath = 'production.exe'
  29. $lastWrite = (get-item $FilePath).LastWriteTime
  30. $timespan = new-timespan -minutes 15
  31.  
  32. if (((get-date) - $lastWrite) -lt $timespan) {
  33. # do this if file newer
  34. } else {
  35. # do this if file older
  36. }
  37.  
  38. PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command "& 'powershellscriptname.ps1'"
  39.  
  40. start-process C:batch.bat
  41.  
  42. Move-Item c:lighthouseproduction.exe c:lighthouseproduction_old.exe -force -ErrorAction SilentlyContinue
  43. $files = @("c:lighthouseproduction.exe","c:RAR_and_Mailproduction.exe")#,"i:production.exe")
  44. foreach ($file in $files){
  45. Copy-item c:productionbackupproduction.exe $file -force
  46. }
  47. Start-Sleep -s 300
  48. $FilePath = 'c:lighthouseproduction.exe'
  49. $lastWrite = (get-item $FilePath).LastWriteTime
  50. $timespan = new-timespan -minutes 15
  51.  
  52. if (((get-date) - $lastWrite) -lt $timespan) {
  53. # do this if file newer
  54. Copy-item "c:RAR_and_Mail*.rar" "c:RAR_and_Mailold*.rar" -force -ErrorAction SilentlyContinue
  55. Remove-Item "c:RAR_and_Mail*.rar"
  56. $MyDate = get-date
  57. $Rarfile = "c:RAR_and_mail" + "$MyDate" + "_production.rar"
  58. & "C:Program FilesWinRARrar" a r "$Rarfile" "c:RAR_and_mail*.exe"
  59. start-process c:batchesSendMail_Executable.bat
  60. } else {
  61. # do Nothing, file older.
  62. }
  63.  
  64. start-process "insert 1st_bat_file path here"
  65. $FilePath = 'production.exe'
  66. $lastWrite = (get-item $FilePath).LastWriteTime
  67. $timespan = new-timespan -minutes 15
  68.  
  69. if (((get-date) - $lastWrite) -lt $timespan) {
  70. # do this if file newer
  71. start-process "insert 2nd_bat_file path here"
  72. start-process c:batchesSendMail_Executable.bat
  73. } else {
  74. # do this if file older
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement