Created
May 14, 2020 15:10
-
-
Save buxtonpaul/2074bc4c56f53cf37a27e3d59ca7a29b to your computer and use it in GitHub Desktop.
Quick'n'dirty python script to create the display variable for use with WSL2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import os | |
for line in os.popen('ipconfig.exe'): | |
if not line[0] in [' ', '\n']: | |
current_section = line | |
active = False | |
if 'Link-local IPv6 Address' in line: | |
active = True | |
if 'IPv4 Address' in line and active and not 'vEthernet' in current_section: | |
vals = line.split(':') | |
print(vals[-1].strip()+":0") | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment