Comments (8)
Very bad. I'll do some tests...
from sophia-script-for-windows.
That would be great. Thank you.
from sophia-script-for-windows.
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.
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.
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.
from sophia-script-for-windows.
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.
Think you should find distro in default folder: MicrosoftDocs/WSL#251
from sophia-script-for-windows.
Related Issues (20)
- Cannot confirm anything on Windows 11 HOT 4
- Changing User subfolders location doesn't update properly. HOT 5
- Unpin all pins for Windows 11 Start Menu not working? HOT 4
- Sophia.psm1:4945:27: Не удалось найти диск. Диск с именем ""C" не существует HOT 1
- Question: Compatibility with `O&O ShutUp10++`? HOT 11
- add function to hide User Folders from This PC HOT 11
- Telemetry enabled? HOT 6
- Disable Automatic sample submission for Microsoft Defender HOT 1
- BingSearch - more settings HOT 1
- No internet connection, second time running the script. HOT 3
- [WinAPI.GetStr]::GetString() RuntimeException HOT 4
- Close taskschd.msc after Function "CleanupTask -Register" or "TempTask -Register" HOT 1
- small feature request: add adguard dns ip's to DNSoverHTTPS function HOT 6
- Terminal closes upon selecting 'Yes' indicated Sophia.ps1 file had been modified HOT 5
- [Question] harmful tweakers = winutil HOT 8
- windows 11 pro workstation latest update HOT 2
- WARNING: Get-WindowsEdition broken or removed from Windows. HOT 20
- VERBOSE: Task Scheduler broken or removed from Windows. HOT 30
- Sophia Script detecting the use of other scripts even after using a restore point. HOT 5
- Bypass - Warning HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sophia-script-for-windows.