pause_zoffline.bat 506 B

123456789101112131415161718192021222324
  1. <# :
  2. @ECHO OFF
  3. TITLE pause_zoffline
  4. NET SESSION >nul 2>&1 || ( PowerShell start -verb runas '"%~0"' & EXIT /B )
  5. powershell /nologo /noprofile "iex (${%~f0} | out-string)"
  6. TASKKILL /F /IM ZwiftLauncher.exe >nul 2>&1
  7. ECHO zoffline is paused
  8. ECHO.
  9. PAUSE
  10. #>
  11. $hostsPath = "$env:windir\System32\drivers\etc\hosts"
  12. $hosts = get-content $hostsPath
  13. $hosts | Foreach {if ($_ -match '^\s*([^#].*?\d{1,3}.*?zwift.*)')
  14. {"# " + $matches[1]} else {$_}} |
  15. Out-File $hostsPath -enc ascii