Skip to content

Instantly share code, notes, and snippets.

@tomfanning
Last active September 2, 2024 07:26
Show Gist options
  • Save tomfanning/77f20a1bb50055e915f4 to your computer and use it in GitHub Desktop.
Save tomfanning/77f20a1bb50055e915f4 to your computer and use it in GitHub Desktop.
Batch file to clear all credentials from Windows Credential Manager
@echo off
cmdkey.exe /list > "%TEMP%\List.txt"
findstr.exe Target "%TEMP%\List.txt" > "%TEMP%\tokensonly.txt"
FOR /F "tokens=1,2 delims= " %%G IN (%TEMP%\tokensonly.txt) DO cmdkey.exe /delete:%%H
del "%TEMP%\List.txt" /s /f /q
del "%TEMP%\tokensonly.txt" /s /f /q
echo All done
pause
@Atha1Kishan
Copy link

I have tried using following and it worked for me.
Open Powershell and run the following commands
Following will remove Adobe credentials
cmdkey /list | Select-String "Adobe" -SimpleMatch | ForEach-Object { cmdkey /delete:($_ -replace "^.+?Target: ","") }

Following will remove Microsoft credentials
cmdkey /list | Select-String "Microsoft" -SimpleMatch | ForEach-Object { cmdkey /delete:($_ -replace "^.+?Target: ","") }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment