Requirements -
Before running this script, you will need to add the following as the first line of your hosts file #previp:place_current_ip_here
Make sure to replace place_current_ip_here
with the current value returned in wsl from hostname -I
, this is what the script looks for the know what to replace.
To run -
Open a Powershell instance with administrator privileges and execute the python script python \path\to\file\wsl-hosts-rename.py