GithubHelp home page GithubHelp logo

Comments (8)

farag2 avatar farag2 commented on May 19, 2024

Very bad. I'll do some tests...

from sophia-script-for-windows.

rockiger avatar rockiger commented on May 19, 2024

That would be great. Thank you.

from sophia-script-for-windows.

farag2 avatar farag2 commented on May 19, 2024

Actually I do not how to test but here's my thoughts

# Change %TEMP% environment variable path back to default
# https://github.com/microsoft/WSL/issues/5437
if (-not (Test-Path -Path $env:LOCALAPPDATA\Temp))
{
	New-Item -Path $env:LOCALAPPDATA\Temp -ItemType Directory -Force
}
if (-not (Test-Path -Path $env:SystemRoot\TEMP))
{
	New-Item -Path $env:SystemRoot\TEMP -ItemType Directory -Force
}

[Environment]::SetEnvironmentVariable("TMP", "$env:LOCALAPPDATA\Temp", "User")
[Environment]::SetEnvironmentVariable("TMP", "$env:LOCALAPPDATA\Temp", "Machine")
[Environment]::SetEnvironmentVariable("TMP", "$env:LOCALAPPDATA\Temp", "Process")
New-ItemProperty -Path HKCU:\Environment -Name TMP -PropertyType ExpandString -Value %USERPROFILE%\AppData\Local\Temp -Force

[Environment]::SetEnvironmentVariable("TEMP", "$env:SystemDrive\Temp", "User")
[Environment]::SetEnvironmentVariable("TEMP", "$env:SystemDrive\Temp", "Machine")
[Environment]::SetEnvironmentVariable("TEMP", "$env:SystemDrive\Temp", "Process")
New-ItemProperty -Path HKCU:\Environment -Name TEMP -PropertyType ExpandString -Value %USERPROFILE%\AppData\Local\Temp -Force

New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -Name TMP -PropertyType ExpandString -Value %SystemRoot%\TEMP -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -Name TEMP -PropertyType ExpandString -Value %SystemRoot%\TEMP -Force



# Adding "swap=0" to the .wslconfig
# https://github.com/microsoft/WSL/issues/5437
if (-not (Test-Path -Path "$env:HOMEPATH\.wslconfig"))
{
	$wslconfig = @"
[wsl2]
swap=0
"@
	# Saving .wslconfig in UTF-8 encoding
	Set-Content -Path "$env:HOMEPATH\.wslconfig" -Value (New-Object System.Text.UTF8Encoding).GetBytes($wslconfig) -Encoding Byte -Force
}
else
{
	$String = Get-Content -Path "$env:HOMEPATH\.wslconfig" | Select-String -Pattern "swap=" -SimpleMatch
	if ($String)
	{
		(Get-Content -Path "$env:HOMEPATH\.wslconfig").Replace("swap=1", "swap=0") | Set-Content -Path "$env:HOMEPATH\.wslconfig" -Force
	}
	else
	{
		Add-Content -Path "$env:HOMEPATH\.wslconfig" -Value "`r`nswap=0" -Force
	}
}



# Restart required

Do not know whether it help. But it'll be better to see what's going on remotely. May be within TeamViewer.

from sophia-script-for-windows.

farag2 avatar farag2 commented on May 19, 2024

Just found in Google: https://dev.to/kapilgorve/move-install-wsl-distro-from-c-drive-to-another-drive-19g9
Does wsl --list --verbose show your distro?

from sophia-script-for-windows.

tomatsaev avatar tomatsaev commented on May 19, 2024

Edit: WSL2 doesn't properly work after running the script. Reinstalling didn't help. Trying system recovery now

Edit N2: fixed it by changing the %temp% back, running wsl and then the script again.

from sophia-script-for-windows.

farag2 avatar farag2 commented on May 19, 2024

#43

from sophia-script-for-windows.

rockiger avatar rockiger commented on May 19, 2024

Unfortunately this didn't work for me the distro is still not there. Bummer, but I will get over it. I will have to recreate my project. Will be probably faster this time :(.

Anyhow, thanks a lot for caring.

from sophia-script-for-windows.

farag2 avatar farag2 commented on May 19, 2024

Think you should find distro in default folder: MicrosoftDocs/WSL#251

from sophia-script-for-windows.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.