Need a script for delete all credentials using CMDkey RRS feed

  • General discussion

  • Code script for delete all credentials using CMDkey

    Your bat file should look like that:

    cmdkey.exe /list > c:\txt.txt
    findstr.exe Target c:\txt.txt > c:\example.txt
    FOR /F "tokens=2 delims==" %%G IN (C:\example.txt) DO cmdkey.exe /delete %%G

    Thanks to Gresserman Ilan

    • Changed type tracycai Tuesday, July 9, 2013 5:36 AM
    Monday, July 8, 2013 5:48 AM

All replies

  • Hi,

    Sorry, you are asking in the wrong forum. For script related question, I suggest posting a new question in the Scripting Forumfor further discussion.

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Tracy Cai
    TechNet Community Support

    Tuesday, July 9, 2013 5:36 AM
  • Thank you for the advice...I was searching high and low for how to do this.  I think you were very close however didn't work for me on Windows 7 without a bit of tweaking.  I ended up with:

    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%\*.*" /s /f /q

    Hope this helps someone else who was as desperate as I!  :-)

    Tuesday, October 8, 2013 8:14 PM
  • for /f "usebackq tokens=2 delims==" %A in (`cmdkey -list^|findstr target`) do cmdkey /delete:%A
    Tuesday, March 19, 2019 1:25 PM
  • This was very helpful! 

    Thank you!

    Tuesday, March 24, 2020 9:52 PM
  • For Microsoft/Windows/TechNet scripts follow the link.


    a script youre looking for is already developed.....

    Wednesday, March 25, 2020 2:31 AM