What I do is have a bat file that runs on startup for my PC that waits for the 2nd and 3rd drive to be mounted on my system then wipes the cache using the command line, you can then use a 3rd program to hide the command prompt if you like, example: hstart.exe
The batch file loops adding 1 every ten seconds to a variable, if it ever gets to 60 (600 seconds give or take) the bat file closes so it doesn't run in the background forever.
The DriveExists.txt text file doesn't even need anything in it, it just needs to exist.
@echo off
echo this window will close when the H and J drives exists
set LoopCount=1
:waitLabel
IF not exist H:\DriveExists.txt (
timeout 10 /nobreak > nul
set /a LoopCount=%LoopCount%+1
if %LoopCount% equ 60 ( goto endOfScriptLabel )
goto waitLabel
)
echo past H
set /a LoopCount=0
:waitLabelTwo
IF not exist J:\DriveExists.txt (
timeout 10 /nobreak > nul
set /a LoopCount=%LoopCount%+1
if %LoopCount% equ 60 ( goto endOfScriptLabel )
goto waitLabelTwo
)
echo past J
REM the following if is only to indent the items run after mounting volumes
IF exist H:\DriveExists.txt (
REM other code removed for example.
cd C:\Program Files\VeraCrypt
veracrypt /w
)
:endOfScriptLabel
@echo on