Jenkins_StartService

@ECHO OFF

IF %1]==] GOTO Usage

FOR /F "TOKENS=1,2 DELIMS=/ " %%A IN ("%1") DO SET @DependedServer=%%A&SET @DependedService=%%B
IF ERRORLEVEL 1 (
   ECHO ERROR: ** The input parameters init failed
   GOTO ExitError
)

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
ECHO ::::: Start depended service - %@DependedServer%/%@DependedService%
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

ECHO INFO : ## Start depended service - %@DependedServer%/%@DependedService% ...
SC \\%@DependedServer% START %@DependedService%
IF ERRORLEVEL 1 (
   ECHO ERROR: ** Start depended service -  %@DependedServer%/%@DependedService% failed
   GOTO ExitError
)

ECHO INFO : ## Start depended service -  %@DependedServer%/%@DependedService% successfully
EXIT /B 0

:ExitError
ECHO Error : ** Start depended service -  %@DependedServer%/%@DependedService% failed
EXIT /B 1

:Usage
ECHO Usage: %0 DependedServer/DependedService
ECHO Example: %0 SZGFDEVAP11/DMWatchService

posted @ 2012-08-06 10:09  Alex Tian  阅读(217)  评论(0编辑  收藏  举报