Skip to content

Commit

Permalink
Unset read-only before replacing hosts
Browse files Browse the repository at this point in the history
Addresses the following issue:
#54
  • Loading branch information
ScriptTiger committed May 24, 2021
1 parent 105046b commit 536f89d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Hosts_Update.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -513,12 +513,17 @@ rem Filter Unified Hosts to remove white space and entries from ignore list
)
) > "%CHOSTS%"

rem Wait some time to make sure all the processes are done accessing the hosts
rem Overwrite the old hosts with the new one
rem Wait some time between changes to make sure all the processes are done accessing the hosts
:Write

timeout /t 3 /nobreak > nul
call :Execute attrib -R "%HOSTS%"

:Write
timeout /t 3 /nobreak > nul
call :Execute copy "%CHOSTS%" "%HOSTS%" /y

timeout /t 3 /nobreak > nul
call :Execute attrib +R "%HOSTS%"

rem Make sure the hosts file was placed correctly and take action accordingly
Expand Down

0 comments on commit 536f89d

Please sign in to comment.