Files
zwift-offline/scripts/pause_zoffline.bat
T
Bart 822305858d Added ability to pause and unpause zwift-offline
functionality by commenting out the entries in the hosts file
2025-04-02 14:09:22 -03:00

24 lines
506 B
Batchfile

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