Note the param SVCNAME this corrsponds to the server directory at JBOSS_HOME path.
Also note that we use SVCNAME to stop the server, if your svc name is different from the actual url, you may need an additional parameter here.
Below is the bat file, edit it and install it.
@echo off REM JBoss, the OpenSource webOS REM REM Distributable under LGPL license. REM See terms of license at gnu.org. REM REM ------------------------------------------------------------------------- REM JBoss Service Script for Windows REM ------------------------------------------------------------------------- @if not "%ECHO%" == "" echo %ECHO% @if "%OS%" == "Windows_NT" setlocal set DIRNAME=%CD% REM REM VERSION, VERSION_MAJOR and VERSION_MINOR are populated REM during the build with ant filter. REM REM ---------------------Aldera----------------------------- REM -------------------------------------------------------- REM SVCNAME should be set with the value of theREM The Service bat should be named -SERVICE.bat REM The Client start up bat should be named .bat REM -------------------------------------------------------- REM -------------------------------------------------------- set SVCNAME=DEPLOYMENT_DIRECTORY set SVCDISP=%SVCNAME% set SVCDESC=JBoss Application Server 6.2 for BASE_HEAD set NOPAUSE=Y set JBOSS_HOME=C:\JBOSS6.2 set JAVA_HOME=C:\jdk1.7.0_51 REM Suppress killing service on logoff event set "JAVA_OPTS=-Xms2G -Xmx2G -XX:MaxPermSize=512M -XX:+UseConcMarkSweepGC -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jbos88,server=y,suspend=n" set CLIENT_FOLDER=%SVCNAME% set SERVICE_LOG=%JBOSS_HOME%\%CLIENT_FOLDER%\log\service.log set CLIENT_DIR_BAT=%SVCNAME%.bat set JBOSS_SERVICE_BAT=%SVCNAME%-SERVICE.bat REM Figure out the running mode if /I "%1" == "install" goto cmdInstall if /I "%1" == "uninstall" goto cmdUninstall if /I "%1" == "start" goto cmdStart if /I "%1" == "stop" goto cmdStop if /I "%1" == "restart" goto cmdRestart if /I "%1" == "signal" goto cmdSignal echo Usage: service install^|uninstall^|start^|stop^|restart^|signal goto cmdEnd REM jbosssvc retun values REM ERR_RET_USAGE 1 REM ERR_RET_VERSION 2 REM ERR_RET_INSTALL 3 REM ERR_RET_REMOVE 4 REM ERR_RET_PARAMS 5 REM ERR_RET_MODE 6 :errExplain if errorlevel 1 echo Invalid command line parameters if errorlevel 2 echo Failed installing %SVCDISP% if errorlevel 4 echo Failed removing %SVCDISP% if errorlevel 6 echo Unknown service mode for %SVCDISP% goto cmdEnd :cmdInstall jbosssvc.exe -imwdc %SVCNAME% "%DIRNAME%" "%SVCDISP%" "%SVCDESC%" %JBOSS_SERVICE_BAT% if not errorlevel 0 goto errExplain echo Service %SVCDISP% installed goto cmdEnd :cmdUninstall jbosssvc.exe -u %SVCNAME% if not errorlevel 0 goto errExplain echo Service %SVCDISP% removed goto cmdEnd :cmdStart REM Executed on service start jbosssvc.exe -p 1 "Starting %SVCDISP%" > %SERVICE_LOG% call %CLIENT_DIR_BAT% jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> %SERVICE_LOG% goto cmdEnd :cmdStop REM Executed on service stop jbosssvc.exe -p 1 "Shutting down %SVCDISP%" > %SERVICE_LOG% call jboss-cli.bat --connect --controller=%SVCNAME%:9999 command=:shutdown > %SERVICE_LOG% 2>&1 jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> %SERVICE_LOG% goto cmdEnd :cmdRestart REM Executed manually from command line REM Note: We can only stop and start jbosssvc.exe -p 1 "Shutting down %SVCDISP%" >> %SERVICE_LOG% call jboss-cli.bat --connect --controller=%SVCNAME%:9999 command=:shutdown :waitRun jbosssvc.exe -s 1 jbosssvc.exe -p 1 "Restarting %SVCDISP%" >> %SERVICE_LOG% call %CLIENT_DIR_BAT% jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> %SERVICE_LOG% goto cmdEnd :cmdSignal REM Send signal to the service. REM Requires jbosssch.dll to be loaded in JVM @if not ""%2"" == """" goto execSignal echo Missing signal parameter. echo Usage: service signal [0...9] goto cmdEnd :execSignal jbosssvc.exe -k%2 %SVCNAME% goto cmdEnd :cmdEnd