Added ability to pause and unpause zwift-offline

functionality by commenting out the entries in the hosts file
This commit is contained in:
Bart
2025-04-02 19:09:22 +02:00
committed by GitHub
parent 51a98b1175
commit 822305858d
2 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
<# :
@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

View File

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