At times, you may want to clear all credentials stored in the Credentials Manager; for example, when you’re having issues using your password on your Windows device, but the password works on all your other devices. In this post, we show you how to clear all credentials from Credential Manager in Windows 11/10 using a Batch file.
Windows Credentials Manager is the place where your usernames and passwords, as well as other login details, are stored for later use in a digital library. This includes information for websites and apps, as well as network credentials.
Credentials are split into four categories viz:
- Windows Credentials – are used only by Windows and its services. For example, Windows can use these credentials to automatically log you into the shared folders of another computer on your network. It can also store the password of the Homegroup you have joined and uses it automatically each time you access what is being shared in that Homegroup. If you type a wrong log-in credential, Windows remembers it and fails to access what you need. If this happens, you can edit or remove the incorrect credential, as shown in later sections of this article.
- Certificate-Based Credentials – they are used together with smart cards, mostly in complex business network environments. Most people will never need to use such credentials and this section is empty on their computers.
- Generic Credentials – are defined and used by some of the apps you install in Windows so that they get the authorization to use certain resources. Examples of such apps include OneDrive, Slack, Xbox Network (formerly Xbox Live), etc.
- Web Credentials – they represent login information for websites that is stored by Windows, Skype, Internet Explorer or other Microsoft apps. They exist only in Windows 10 and Windows 8.1, but not in Windows 7.
Read: How to delete Credentials from Credential Manager using Command Prompt.
Clear all credentials from Credential Manager
While you can individually clear or remove credentials, you can create this batch file sourced from Github and run it to clear all credentials from Credential Manager. Here’s how:
- Press Windows key + R to invoke the Run dialog.
- In the Run dialog box, type notepad and hit Enter to open Notepad.
- Copy and paste the code below into the text editor.
@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
- Save (to the desktop, preferably) the file with a name and append the .bat file extension – eg; ClearCREDS.bat and on the Save as type box select All Files.
To clear all credentials, simply run the batch file with admin privilege (right-click the saved file and select Run as Administrator from the context menu).
You can also schedule the batch file to run automatically in Windows 11/10 if you want.
That’s it!
Related post: How to Add, Backup, Restore User Credentials using Windows Vault.