For Firefox, you have to create the value in about:config -- https://support.mozilla.org/en-US/questions/1317032
For Chrome, use --disk-cache-dir: <path to desired cache folder>
For example, the "Target" in the Chrome shortcut might be:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --disk-cache-dir="D:\mycache"
More details here: https://www.ghacks.net/2010/10/19/how-to-change-google-chromes-cache-location-and-size/
And for other information: https://dannyda.com/2019/12/19/how-to-change-browser-cache-directory-location-google-chrome-mozilla-firefox/