Skip to content

Instantly share code, notes, and snippets.

@ozkary
Created June 4, 2025 14:00
Show Gist options
  • Save ozkary/c8dd98ab5f8b8290f158de2113a8172e to your computer and use it in GitHub Desktop.
Save ozkary/c8dd98ab5f8b8290f158de2113a8172e to your computer and use it in GitHub Desktop.
Restores VSCode files after a windows update has isolated the files into a different folder
@echo off
setlocal
:: ==============================================================
:: Fix VS Code Folder Issue after Windows Update
:: ==============================================================
:: Some Windows updates seem to be isolating VS Code files under a "_"
:: subfolder inside the main installation directory. This script checks
:: if such a folder exists and prompts the user before moving its
:: contents back to the correct location.
:: ==============================================================
:: Define the VS Code installation directory
set "vscodeDir=%USERPROFILE%\AppData\Local\Programs\Microsoft VS Code"
:: Define the misplaced folder path
set "underscoreDir=%vscodeDir%\_"
:: Check if the "_" directory exists
if not exist "%underscoreDir%" (
echo No misplaced files found. Nothing to fix!
exit /b
)
:: Prompt user for confirmation
echo A misplaced folder ("_") was found inside the VS Code installation directory.
set /p userInput=Do you want to move its contents back to the parent folder? (Y/N):
:: Convert input to uppercase to handle lowercase entries
if /I not "%userInput%"=="Y" (
echo Operation canceled.
exit /b
)
:: Move files back to the parent directory
echo Moving files back to parent directory...
move "%underscoreDir%\*" "%vscodeDir%"
echo Done! The misplaced files have been restored.
endlocal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment