0

How to clear the Chromium cache on startup, via Chrome command-line arguments?

I have already read Clear Chrome's cache via CLI but the goal is slightly different.

I need Chromium (embedded) to bypass CSS files and JS files cache on startup and use new files if they have been modified.

Usually I need to manually CTRL F5 after each CSS+JS files modification, even after a Chromium relaunch (without it, it doesn't update), and I'd like to avoid this because it's an embedded computer without keyboard.

2
  • What platform? Ctrl/F5 suggests Windows but your linked question is on Mac.
    – Tetsujin
    Jul 5, 2023 at 7:48
  • @Tetsujin Yes Windows. If possible, I would like to avoid to have to manually mingle with the filesystem cache folder.
    – Basj
    Jul 5, 2023 at 8:18

1 Answer 1

1

Google Chrome does not have a specific command-line switch for clearing the cache.

A simple solution might be to specify your own cache folder, rather than letting Chrome use its default, and delete the contents of the folder before running it.

The parameter is similar to : --disk-cache-dir="C:\Temp".

To delete all files and sub-folders inside the folders, you could use the following .bat file:

del /q "C:\Temp\*"
FOR /D %%p IN ("C:\Temp\*.*") DO rmdir "%%p" /s /q

Note that del by itself is not enough, since it only deletes files and not sub-folders, which is why rmdir is required. You could also add the Chrome invocation at the end of the file.

7
  • I think you meant Google Chrome, rather than Chromium.
    – harrymc
    Jul 5, 2023 at 8:31
  • Thanks! This looks like a good solution! Would it also be possible to totally disable cache, from command-line?
    – Basj
    Jul 5, 2023 at 8:33
  • I would have said to set --disk-cache-size=0, except for this 2015 bug-report Issue 447590: --disk-cache-size=0 --media-cache-size=0 options are not respected that has as status "WontFix". If nothing has changed since then, then the batch file is left as the solution.
    – harrymc
    Jul 5, 2023 at 8:41
  • 1
    I haven't found any.
    – harrymc
    Jul 5, 2023 at 9:08
  • 1
    That's the situation as far as I know.
    – harrymc
    Jul 5, 2023 at 12:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .