Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@ion-storm

This comment has been minimized.

Copy link

commented Jan 5, 2017

one line:
for /F "tokens=1,2 delims= " %G in ('cmdkey /list ^| findstr Target') do cmdkey /delete %H

@ukmercanary

This comment has been minimized.

Copy link

commented May 2, 2019

Works great thanks alot!

@memehunter

This comment has been minimized.

Copy link

commented Jun 4, 2019

thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.