In addition to Leo's good backup idea...
You could try the WatchCat script.
If you hfs menu > save settings > to file
then the watchcat script will backup and then roll back to working settings if an error occurs while HFS is running
see that copy command (one in startup for backup and one in error for rollback) and notice that it could be expanded to first back up the vfs and then utilize the backup on the fly if errors occurred.
Those features of the watchcat2 script are for the purpose of 'locking down' working condition. So, you'd first get HFS running as you like. . . and afterwards start up the watchcat script to make HFS stay put.
For example (watchcat edited to include vfs backup and restore):
@echo off
copy hfs.ini hfsini.bak /y
copy myvfs.vfs myvfs.bak /y
CLS
@echo /\ /\
@echo { ''''' }
@echo _{_ O O _}_
@echo WatchCat is now running
:ONE
timeout /t 30 > nul
VER > nul
wget 127.0.0.1:80/favicon.ico --output-document=nul --quiet --wait=10 --tries=3
IF %ERRORLEVEL% NEQ 0 GOTO TWO
GOTO ONE
:TWO
@echo !
@echo HFS did not respond.
@echo Exiting...
date /T
time /T
TASKKILL /IM hfs.exe /F > nul
timeout /t 3 > nul
@echo ------------------------
copy myvfs.bak myvfs.vfs /y >nul
copy hfsini.bak hfs.ini /y > nul
timeout /t 2 > nul
@echo Starting HFS
start "" "hfs.exe" -c start-minimized=yes -c active=yes
GOTO ONE
if not port 80, be sure to put the actual port number
if not myvfs.vfs, be sure to use the actual file name
wget is in the zip file:
https://rejetto.com/forum/index.php?topic=12055.msg1065322#msg1065322