For what it’s worth, here is a crude implementation, totally without warranty and unmaintained.
Backup:
@echo off
xcopy "%LOCALAPPDATA%\pimax\runtime\profile.json" .
Will copy the current profile.json into the folder where the batch file is located.
For the restore scripts, I’d suggest using a folder structure like this:
The leading numbers are optional.
Simple restore:
@echo off
SETLOCAL
SET "profile="
SET srcfile=%profile%\profile.json
IF exist "%srcfile%" (
echo copying "%srcfile%" to "%LOCALAPPDATA%\pimax\runtime"
xcopy /y "%srcfile%" "%LOCALAPPDATA%\pimax\runtime"
PAUSE
) ELSE (
echo ERROR: "%srcfile%" does not exist
)
ENDLOCAL
All that is necessary is to create a batch file for each game and set the “profile” parameter to the directory containing the profile.json e.g.:
SET "profile=01 IL2"
Interactive restore:
@echo off
:while
SETLOCAL
SET "profile="
SET "source="
SET cnt=0
SET /p profile="Enter profile: "
IF "%profile%"=="" (
echo ERROR: please enter a profile
GOTO :while
)
FOR /f "delims=?" %%A IN ('dir /ad /b "*%profile%*"') DO (
SET source=%%A
SET /A cnt=cnt+1
)
SET srcfile=%source%\profile.json
IF "%cnt%"=="1" (
IF exist "%srcfile%" (
echo copying "%srcfile%" to "%LOCALAPPDATA%\pimax\runtime"
xcopy /y "%srcfile%" "%LOCALAPPDATA%\pimax\runtime"
PAUSE
GOTO :end
) ELSE (
echo ERROR: %srcfile% does not exist
)
)
IF "%cnt%"=="0" (
echo ERROR: profile "%profile%" does not exist
)
IF %cnt% gtr 1 (
echo ERROR: profile %profile% is not unique
)
ENDLOCAL
GOTO :while
:end
ENDLOCAL
This will prompt you for a profile and search for it.
All that is necessary now is to restart the PiServiceLauncher, must be run as administrator.