@echo off
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("%~nx0 h",0)(window.close)&&exit
:begin
在这下面再去执行你自定义的bat命令
@echo off
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("%~nx0 h",0)(window.close)&&exit
:begin
java -jar rocketmq-console-ng-1.0.1.jar
@echo off
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("%~nx0 h",0)(window.close)&&exit
:begin
.\mqbroker.cmd -n 127.0.0.1:9876 autoCreateTopicEnable=true
@echo off
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("%~nx0 h",0)(window.close)&&exit
:begin
./mqnamesrv.cmd
@echo off
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("%~nx0 h",0)(window.close)&&exit
:begin
.\startup.cmd -m standalone
windows根据端口号杀掉进程脚本
@echo off
set port=20002
for f "tokens=5" %%a in ('netstat /ano | findstr %port%') do taskkill /F /pid %%a
//for循环,提取第5个字段(从命令的结果中)赋予到变量a,并执行杀进程调用变量a
pause
上面那个脚本文件中端口号写死了,可以提取出来当成参数传递
@echo off
set port=%1
for /f "tokens=5" %%a in ('netstat /ano | findstr %port%') do taskkill /F /pid %%a
//for循环,提取第5个字段(从命令的结果中)赋予到变量a,并执行杀进程调用变量a
pause
文章转载自IT学习道场,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。