Skip to content

Instantly share code, notes, and snippets.

@ledsun
Created November 24, 2021 00:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ledsun/c3e012e8a6d727bef00cae6644b40f68 to your computer and use it in GitHub Desktop.
Save ledsun/c3e012e8a6d727bef00cae6644b40f68 to your computer and use it in GitHub Desktop.
netsh.exe interface portproxy delete v4tov4 8000
netsh.exe interface portproxy show v4tov4
pause
FOR /F "usebackq" %%i in (`wsl exec hostname -I`) DO @SET IP=%%i
netsh interface portproxy add v4tov4 listenport=8000 connectaddress=%IP%
netsh.exe interface portproxy show v4tov4
pause
<?xml version='1.0' encoding='utf-8'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Name='WSLポートフォワード設定'
Id='{D5FB36DD-CE53-4BD8-AD99-0071F603BFBC}'
UpgradeCode='{874C9191-4725-45F5-9A9A-079C11932324}'
Language='1041' Codepage='932'
Version='1.0.0' Manufacturer='ledsun'>
<Package Id='*' Keywords='WSLポートフォワード設定'
Description="WSLのIPアドレスへのポートフォワード設定をON/OFFします"
Manufacturer='ledsun' InstallerVersion='100'
Languages='1041' Compressed='yes' SummaryCodepage='932' />
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt='CD-ROM 1枚目' />
<Property Id='DiskPrompt' Value="WSLポートフォワード設定 インストーラ [1]" />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='ledsun' Name='ledsun'>
<Directory Id='INSTALLDIR' Name='port-forward'>
<Component Id='PortForwardOn'
Guid='{E2558918-C7AC-42AA-AA82-C318B53D1202}'>
<File Id='ON'
Name='port-forward-on.bat' DiskId='1'
Source='port-forward-on.bat' >
<Shortcut Id="startmenuon" Directory="DesktopFolder"
Name="WSLポートフォワード設定 ON" WorkingDirectory='INSTALLDIR' />
</File>
<RegistryValue Root='HKCU'
Key='Software\[Manufacturer]\[ProductName]\PortForwardOn'
Type='string' Value='' KeyPath='yes' />
</Component>
<Component Id='PortForwardOff'
Guid='{2A5AD250-7E0D-43D7-B587-884DCC8FE70F}'>
<File Id='OFF'
Name='port-forward-off.bat' DiskId='1'
Source='port-forward-off.bat' >
<Shortcut Id="startmenuoff" Directory="DesktopFolder"
Name="WSLポートフォワード設定 OFF" WorkingDirectory='INSTALLDIR' >
</Shortcut>
</File>
<RegistryValue Root='HKCU'
Key='Software\[Manufacturer]\[ProductName]\PortForwardOff'
Type='string' Value='' KeyPath='yes' />
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<Feature Id='Complete' Level='1'>
<ComponentRef Id='PortForwardOn' />
<ComponentRef Id='PortForwardOff' />
</Feature>
</Product>
</Wix>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment