mirror of
https://github.com/zoffline/zwift-offline.git
synced 2026-03-12 21:23:00 -07:00
Added ability to pause and unpause zwift-offline
functionality by commenting out the entries in the hosts file
This commit is contained in:
23
scripts/pause_zoffline.bat
Normal file
23
scripts/pause_zoffline.bat
Normal 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
|
||||
23
scripts/unpause_zoffline.bat
Normal file
23
scripts/unpause_zoffline.bat
Normal 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
|
||||
Reference in New Issue
Block a user