service_windows.bat 917 B

123456789101112131415161718192021
  1. @echo off
  2. cd "%~dp0"
  3. if not "%1" == "install" ( if not "%1" == "uninstall" ( if not "%1" == "start" ( if not "%1" == "stop" (
  4. echo service_windows.bat install ^| uninstall ^| start ^| stop
  5. echo depends on Microsoft.NET Framework 4
  6. goto out
  7. ))))
  8. if not exist "%~dp0local" (
  9. md "%~dp0local"
  10. )
  11. echo ^<?xml version="1.0" encoding="GBK" ?^> > "%~dp0local\service.xml"
  12. echo ^<configuration^> >> "%~dp0local\service.xml"
  13. echo ^<id^>O2SERVER^<^/id^> >> "%~dp0local\service.xml"
  14. echo ^<name^>O2SERVER SERVICE^<^/name^> >> "%~dp0local\service.xml"
  15. echo ^<description^>O2OA Platform Service.^<^/description^> >> "%~dp0local\service.xml"
  16. echo ^<executable^>"%~dp0start_windows.bat"^</executable^> >> "%~dp0local\service.xml"
  17. echo ^<log mode="none"^/^> >> "%~dp0local\service.xml"
  18. echo ^</configuration^> >> "%~dp0local\service.xml"
  19. copy "%~dp0commons\winsw.exe" "%~dp0local\service.exe"
  20. "%~dp0local\service.exe" %1
  21. :out