Skip to content

Switch WSL service activation from an host to another

License

Notifications You must be signed in to change notification settings

Nyuwb/wsl-switch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License Publish release on GitHub

WSL Switch

Allows you to switch the activation of certain services from one WSL instance to another.

The following services are currently managed, but you can custom it in the config.json file:

  • apache
  • mysql
  • php

Installation

From Scoop

Add the bucket scoop-srsrns.
Then install it directly from this bucket:

scoop bucket add srsrns https://github.com/mbl-35/scoop-srsrns
scoop install wsl-switch

To uninstall it, simply use scoop uninstall wsl-switch

From GitHub

Download the latest build from GitHub.

Unzip it then add the path to the ps1 file in your Powershell profile:

Invoke-Item $Profile
# Set-Alias wsl-switch _path_to_repository_\wsl-switch.ps1

Edit the configuration file

You need to run the following command to edit the configuration file.

wsl-switch config

It will open the config.json file that you can edit.
Save it, and it will direcly be used by the application.

Run the application

To enable the service $service on $hostname, you'll need to type the following command:

wsl-switch $service $hostname

The $hostname parameter is the key stored in the config.json.
You can switch all configured services at once by using the parameter all instead of $service.

Tips: How to install multiple instances

To install multiple WSL instances easier, you can use WSLCTL.
It provides a single command to create, backup and manage WSL instances.