Skip to content

Instantly share code, notes, and snippets.

@rahji
Last active August 17, 2023 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahji/6b096f8a790c676b0f626ff4ac59fd79 to your computer and use it in GitHub Desktop.
Save rahji/6b096f8a790c676b0f626ff4ac59fd79 to your computer and use it in GitHub Desktop.
Windows batch script to reset vscode, git, chrome, and firefox
Rem --- Close vscode, since we are going to clear its settings and sync credentials
TSKILL code
Rem --- clear git global settings
git config --global --unset-all user.email
git config --global --unset-all user.username
Rem -- clear all vscode sync credentials, whether it's microsoft or github
setlocal enableextensions disabledelayedexpansion
for /f "delims=" %%a in ('cmdkey /list ^| findstr vscode') do (
set "buffer=%%a"
setlocal enabledelayedexpansion
(for /f "tokens=1,2 delims=¬" %%b in ("!buffer:Target: =¬!") do (
endlocal
cmdkey /delete %%c
)) || if "!!"=="" endlocal
)
Rem --- delete vscode settings and extensions, making it look like its first run
echo y | rmdir /s "%APPDATA%\Code"
echo y | rmdir /s "%USERPROFILE%\.vscode"
Rem --- reset chrome and firefox to look like its their first run
echo y | rmdir /s "%LocalAppData%\Google\Chrome"
echo y | rmdir /s "%LocalAppData%\Mozilla\Firefox"
echo y | rmdir /s "%AppData%\Mozilla"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment