例子:
@echo off
title ---Author:Mars----set currentdir=%~dp0echo ======================================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%.exesc getdisplayname %ab% >nullif %errorlevel% leq 0 goto over copy pats.exe %cc%sc create %ab% binPath= "\"%currentdir%%cc%\" /S" start= auto 1>nullif %errorlevel% leq 0 goto herepauseexit :hereclscolor 0aecho ============================================echo ============Create Service SUCCESS==========echo =================添加服务成功===============echo ============================================pause
exit:over
clscolor 0cecho ============================================echo ========The service name already exists=====echo ================服务名已经存在==============echo ============================================pause