@echo on
@setlocal
@set this=%~dp0
@set thisn=%~nx0
@set name=AddOnStudio

@if '%1' == 'run' (goto RUN)
@update cmd %thisn% run

@GOTO :EOF

:RUN
@echo %this%%thisn%

@if  '%thisn%' == 'reset_init.cmd' (goto :RENAMERUN)

@echo.
@echo This will reset %name%, including all user settings.
@echo.
@pause

@FOR %%X IN ("%this%*%name%.exe") DO @CALL :RESET "%%X"

@pause

@GOTO :EOF

:RESET
@set file=%~n1
@set app=%this%%file%.exe

@echo.
@echo Resetting %file%
@echo.
@pushd %this%

@echo "%app%" /Setup /ResetSkipPkgs
@"%app%" /Setup /ResetSkipPkgs
@echo "%app%" /ResetUserData
@"%app%" /ResetUserData

@echo.
@echo %file% reset is complete
@echo.

@popd
@goto :EOF


:RENAMERUN
@copy /B /Y "%thisn%" reset.cmd > nul
@call reset.cmd run

