@echo off
IF "%1"=="/?" ( 
echo ExecWSS.bat START/STOP [PATHSTARTFILE]
echo -
echo START 		Start SELTA.
echo STOP	 	Stop SELTA.
echo PATHSTARTFILE	Path of program what need a start.
echo -
echo start.bat START 1cv7s.exe
exit /b 0
) 

rem find SELTA path in system registry
(FOR /F "tokens=1,2*" %%A IN ('reg query HKLM\Software\Etersoft\SELTA@Etersoft\Info /v Path') DO SET SELTAPATH=%%C) 2>nul

rem check exist file SeltaCmd.exe
@echo Find path in system registry -- %SELTAPATH%
if not exist "%SELTAPATH%SeltaCmd.exe" echo FAIL: Can't find file SeltaCmd.exe && exit /b 0

rem start and stop SELTA
IF "%1"=="START" (
call "%SELTAPATH%seltacmd.exe" -st y
) ELSE (
IF "%1"=="STOP" (
call "%SELTAPATH%seltacmd.exe" -st n"
) ELSE (
echo FAIL: Error param 1 "%1"
exit /b 0
)
)

rem start program from param 2
IF %2=="" exit /b 0

if not exist %2 (
echo FAIL: Can't find file %2
) ELSE (
call %2
)
@echo on