@echo off
 
 echo Instalando Drivers
 
 cd services
 del "%APPDATA%\APC\XML\"config.sgm
 copy prunsrv.exe %WINDIR%\System32
 copy rxtxSerial.dll %WINDIR%\System32
 copy win32com.dll %WINDIR%\System32
  
 echo sc stop Controle > "%APPDATA%"\APC\caminho.bat
 echo sc delete Controle >> "%APPDATA%"\APC\caminho.bat
 echo cd "%caminho%" >> "%APPDATA%"\APC\caminho.bat
 echo cd .. >> "%APPDATA%"\APC\caminho.bat
 echo cd Uninstaller >> "%APPDATA%"\APC\caminho.bat
 echo java -jar uninstaller.jar >> "%APPDATA%"\APC\caminho.bat
 echo exit >> "%APPDATA%"\APC\caminho.bat
  
 echo Criando Servico

 set SERVICE_NAME=Controle
 set PR_INSTALL=%caminho%\prunsrv.exe
REM Service log configuration
 set PR_LOGPREFIX=%SERVICE_NAME%
 set PR_LOGPATH=%caminho%\logs
 set PR_STDOUTPUT=%caminho%\logs\stdout.txt
 set PR_STDERROR=%caminho%\logs\stderr.txt
 set PR_LOGLEVEL=Error
 
 REM Path to java installation
 set PR_CLASSPATH=%caminho%\SGM_LITE_SERVICE.jar
REM Startup configuration
 set PR_STARTUP=auto
 set PR_STARTMODE=jvm
 set PR_STARTCLASS=br.com.schneider.sgm.controle.ControleServicoSO
 set PR_STARTMETHOD=main
 set PR_JVM=%jhome%\bin\client\jvm.dll
 set PR_STARTPARAMS=%APPDATA%
REM Shutdown configuration
 set PR_STOPMODE=jvm
 set PR_STOPCLASS=br.com.schneider.sgm.controle.ControleServicoSO
 set PR_STOPMETHOD=encerraAplicativo
REM JVM configuration
 set PR_JVMMS=256
 set PR_JVMMX=1024
 set PR_JVMSS=4000
 set PR_JVMOPTIONS=-Duser.language=DE;-Duser.region=de
REM Install service
 prunsrv.exe //IS//%SERVICE_NAME% --DisplayName="SGM LIGHT Service" --Description="SGM LIGHT Service"
 
 echo Finalizado!
 