Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cd
- cd c:lighthouse
- mv production.exe production_old.exe /Y
- cd
- cd c:productionbackup
- cd
- xcopy "c:productionbackupproduction.exe" "c:lighthouseproduction.exe" /Y
- xcopy "c:productionbackupproduction.exe" "i:production.exe" /Y
- xcopy "c:productionbackupproduction.exe" "c:RAR_and_Mailproduction.exe" /Y
- cd
- cd
- cd c:RAR_and_Mail
- xcopy "c:RAR_and_Mail*.rar" "c:RAR_and_Mailold*.rar" /Y
- del c:RAR_and_Mail*.rar
- set MyDate=%date:/=.%.%
- set WINRAR=C:Program FilesWinRARrar.exe
- set production=c:RAR_and_mail
- cd /D %production%
- "%WINRAR%" a -r -s -m5 /Y /R "%production%%MyDate%_production.rar" "*.exe"
- cd
- call c:batchesSendMail_Executable.bat
- echo off
- set MyDate=%date:/=.%.%
- 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."
- $FilePath = 'production.exe'
- $lastWrite = (get-item $FilePath).LastWriteTime
- $timespan = new-timespan -minutes 15
- if (((get-date) - $lastWrite) -lt $timespan) {
- # do this if file newer
- } else {
- # do this if file older
- }
- PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command "& 'powershellscriptname.ps1'"
- start-process C:batch.bat
- Move-Item c:lighthouseproduction.exe c:lighthouseproduction_old.exe -force -ErrorAction SilentlyContinue
- $files = @("c:lighthouseproduction.exe","c:RAR_and_Mailproduction.exe")#,"i:production.exe")
- foreach ($file in $files){
- Copy-item c:productionbackupproduction.exe $file -force
- }
- Start-Sleep -s 300
- $FilePath = 'c:lighthouseproduction.exe'
- $lastWrite = (get-item $FilePath).LastWriteTime
- $timespan = new-timespan -minutes 15
- if (((get-date) - $lastWrite) -lt $timespan) {
- # do this if file newer
- Copy-item "c:RAR_and_Mail*.rar" "c:RAR_and_Mailold*.rar" -force -ErrorAction SilentlyContinue
- Remove-Item "c:RAR_and_Mail*.rar"
- $MyDate = get-date
- $Rarfile = "c:RAR_and_mail" + "$MyDate" + "_production.rar"
- & "C:Program FilesWinRARrar" a r "$Rarfile" "c:RAR_and_mail*.exe"
- start-process c:batchesSendMail_Executable.bat
- } else {
- # do Nothing, file older.
- }
- start-process "insert 1st_bat_file path here"
- $FilePath = 'production.exe'
- $lastWrite = (get-item $FilePath).LastWriteTime
- $timespan = new-timespan -minutes 15
- if (((get-date) - $lastWrite) -lt $timespan) {
- # do this if file newer
- start-process "insert 2nd_bat_file path here"
- start-process c:batchesSendMail_Executable.bat
- } else {
- # do this if file older
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement