Skip to content

Instantly share code, notes, and snippets.

@pisceanfoot
Created November 2, 2017 08:17
Show Gist options
  • Save pisceanfoot/440b7d0489d26283916818209eb0f5ce to your computer and use it in GitHub Desktop.
Save pisceanfoot/440b7d0489d26283916818209eb0f5ce to your computer and use it in GitHub Desktop.
process watchdog
$programName = "RealTimeSync"
$isRunning = (Get-Process | Where-Object { $_.Name -eq $programName }).Count -gt 0
if(!$isRunning){
echo 'not found RealTimeSync'
Stop-Process -processname "RealTimeSync*"
Start-Process -FilePath "C:\Program Files\FreeFileSync\RealTimeSync.exe" -ArgumentList "E:\sync\Realtime.ffs_real" -WorkingDirectory "C:\Program Files\FreeFileSync"
exit
}
$programName = "RealTimeSync_x64"
$isRunning = (Get-Process | Where-Object { $_.Name -eq $programName }).Count -gt 0
if(!$isRunning){
echo 'not found RealTimeSync'
Stop-Process -processname "RealTimeSync*"
Start-Process -FilePath "C:\Program Files\FreeFileSync\RealTimeSync.exe" -ArgumentList "E:\sync\Realtime.ffs_real" -WorkingDirectory "C:\Program Files\FreeFileSync"
exit
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment