例子:

 

@echo off
title ---Author:Mars----
set currentdir=%~dp0
echo ======================================
echo ===========Current Directory==========
echo ===%currentdir%===
echo ======================================
echo ======================================


set /p aa=(Enter the Pats name,example:RJO_301)
set ab=RMMSoft.GatewayPATS_%aa%
set cc=pats_%aa%.exe
sc getdisplayname %ab% >null
if %errorlevel% leq 0 goto over 


copy pats.exe %cc%
sc create %ab% binPath= "\"%currentdir%%cc%\" /S" start= auto 1>null
if %errorlevel% leq 0 goto here
pause
exit


:here
cls
color 0a
echo ============================================
echo ============Create Service SUCCESS==========
echo =================添加服务成功===============
echo ============================================

pause
exit

:over
cls
color 0c
echo ============================================
echo ========The service name already exists=====
echo ================服务名已经存在==============
echo ============================================
pause