Friday, August 12, 2022

Move C:/Users/{username}/AppData folder to D drive

This article may be useful for those PC owners who has small SSD C drive and needs additional space there without uninstalling apps. Some time ago I wrote an article how to free space on C drive using junction folder links: How to free space on OS Windows drive by moving SoftwareDistribution folder to another disk via junction folder.

Here we will use the same idea but for C:/Users/{username}/AppData folder. In my case WinDirStat showed that most of space is occupied in this folder for my basic user. Moving files from there to D drive included several steps:

1. Create new admin user account and login with this account

2. Go to C:/Users/{username}/AppData for your basic user and rename folder to C:/Users/{username}/AppData.old. If Windows will complain that folder is in use try to use Resource Monitor > CPU > Associated handles tab and search by folder name. It will show all processes which currently use this folder. After that you may kill these processes in Task Manager > Details tab: there is User name column so you may choose those apps which work for your basic user account (and which use files from C:/Users/{username}/AppData).

3. Create new folder on D drive, e.g. D:/UserNameAppData

4. Create junction link using the following command in cmd:

mklink /j C:\Users\{username}\AppData D:\UserNameAppData

5. Move all files from C:/Users/{username}/AppData.old to D:\UserNameAppData

6. Restart PC and login with your basic account

In my case after that Windows start icon stopped working. I tried many instructions to restore it but only the following actually helped: The tale of how I managed to solve a nasty start menu corruption. Will duplicate it here in case this link won't be available:

taskkill /F /IM explorer.exe
taskkill /F /IM SearchApp.exe
taskkill /F /IM SearchUI.exe
taskkill /F /IM ShellExperienceHost.exe
taskkill /F /IM StartMenuExperiencehost.exe
Start-Sleep 2

Set-Location $env:LOCALAPPDATA\Packages\Microsoft.Windows.ShellExperienceHost_cw5n1h2txyewy
Remove-Item -Recurse -Force .\TempState\

Set-Location $env:LOCALAPPDATA\Packages\Microsoft.Windows.StartMenuExperiencehost_cw5n1h2txyewy
Remove-Item -Recurse -Force .\TempState\

Add-AppxPackage -Register "C:\Windows\SystemApps\ShellExperienceHost_cw5n1h2txyewy\AppxManifest.xml" -DisableDevelopmentMode
Add-AppxPackage -Register "C:\Windows\SystemApps\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\AppxManifest.xml" -DisableDevelopmentMode

Start-Process explorer.exe

After that Windows start icon started to work but search in start menu still didn't work. For restoring search in Windows start menu I used another PowerShell command which I found here:

Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

After that search also started to work. Note that if your D drive is not SSD apps may work slower after this change because files will be physically stored on D drive now. Hope that this information will help someone.

No comments:

Post a Comment