unpause_zoffline.bat 519 B

123456789101112131415161718192021222324
  1. <# :
  2. @ECHO OFF
  3. TITLE unpause_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 unpaused
  8. ECHO.
  9. PAUSE
  10. #>
  11. $hostsPath = "$env:windir\System32\drivers\etc\hosts"
  12. $hosts = get-content $hostsPath
  13. $hosts = $hosts | Foreach {if ($_ -match '^\s*#\s*(.*?\d{1,3}.*?zwift.*)')
  14. {$matches[1]} else {$_}}
  15. $hosts | Out-File $hostsPath -enc ascii