How to delete the IntelliJ IDEA caches folder from the command line on Windows?

If you need to clear the IntelliJ IDEA caches to resolve issues, you can safely delete the caches folder without opening the IDE.
Below are the steps to delete the folder using both Cygwin and BAT (cmd).

Using Cygwin:

  1. Open Cygwin.

  2. Run the following command to remove the caches folder, converting the Windows path to Cygwin's format:

    rm -rf $(cygpath "$LOCALAPPDATA")/JetBrains/IntelliJIdea<Version>/caches
    
    • Replace <Version> with your IntelliJ IDEA version (e.g., 2022.3).
    • This command converts %LOCALAPPDATA% to a Cygwin-friendly path using cygpath and deletes the caches folder.

Using BAT (cmd):

  1. Open Command Prompt or create a BAT script.

  2. Run the following command to delete the caches folder:

    rmdir /s /q "%LOCALAPPDATA%\JetBrains\IntelliJIdea<Version>\caches"
    
    • Replace <Version> with the correct version number for IntelliJ IDEA.
    • This command uses the Windows %LOCALAPPDATA% environment variable to locate and remove the caches folder.

After running these commands, the caches folder will be deleted, and IntelliJ IDEA will recreate it the next time the IDE is launched.
This is useful for clearing old cache files or troubleshooting issues with configurations.