-
-
Save tomfanning/77f20a1bb50055e915f4 to your computer and use it in GitHub Desktop.
@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 |
@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
Hi team I would like to add this command to the cleaning credentials bat file:
Go to the path %userprofile%\AppData\Local\Microsoft\Office\16.0\ and delete the folder named OfficeFileCache.
FOR /F "tokens=1,2 delims= " %%G IN ('cmdkey /list ^| findstr OfficeFileCache') do cmdkey /delete %%H
(I am not an expert, very sorry if sounds crazy)
Hello Guys, i m glad to find some echo to remove credentials but i need it for ControlPanel\UserAccounts\CredentialManager\WebCredential what you write top of page is helps to remove WindowsCredentials. Can you help me to remove for WebCredentials? That saved on myComputer. i need it to fix this problem:
When i open my XBOX app and Trying to login previous friends logged in my pc their accounts keep appearing in this list and i want this list clean up.
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: ","") }
Similar to @Atha1Kishan's answer, here's a small script to delete all credentials matching a search string:
# List all credentials in the current user's Credential Manager
$all_creds = cmdkey /list
# Delete all credentials matching a specific pattern, like 'Microsoft:SSMS'
$pattern = "Microsoft:SSMS"
foreach ($cred in $all_creds) {
if ($cred -match "target=(.+)") {
$cred_name = $matches[1]
# Now $cred_name contains everything after "target="
if ($cred_name -like "*$pattern*") {
cmdkey /delete:$cred_name
Write-Output $cred_name
}
}
}
Thanks! This worked for me. I had to add an extra '%' to make it work, as follows:
for /F "tokens=1,2 delims= " %%G in ('cmdkey /list ^| findstr vscode') do cmdkey /delete %%H