How to create a .wslconfig file?

I have installed WSL2 on my Windows 10, but I would like to set up a .wslconfig file in my C:\Users\username folder, with the following instructions:

[wsl2] localhostForwarding=true

I have tried to create a notepad, putting the above in and saving the file as .wslconfig. However, it is still being read as a .txt file rather than .wslconfig. This was the instruction on how to create a .wslconfig file that I read online.

I added a .ini extension, doesn't seem to be detected.

I have tried to find what the error might be. I looked at I am build 19043

1

2 Answers

I just set up a .wslconfig file on my machine.

As an administrator (probably not needed though), I created the file c:\Users\damie\.wslconfig with the following contents:

[wsl2] memory=20GB # Limits VM memory in WSL 2 processors=4 # Makes the WSL 2 VM use 4 virtual processors localhostForwarding=true # Boolean specifying if ports bound to wildcard or localhost in the WSL 2 VM should be connectable from the host via localhost:port. 

After saving, I opened an administrator level powershell windows and executed:

Restart-Service LxssManager

This worked for me.

3

Open command prompt in Admin mode run the command as

notepad "C:\Users<user>.wslconfig"

It will pop up the notepad and show Do you want create new file Click yes and close the file

U can able to see the file in the respective location

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like