加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
start.bat 1.50 KB
一键复制 编辑 原始数据 按行查看 历史
Tyanzhe 提交于 2019-11-23 23:43 . 修改日志内容
@echo off
::设置程序或文件的完整路径(必选)
set curdir=%~dp0
set Program=%curdir%start.bat
::设置快捷方式名称(必选)
set LnkName=RedisLettuceClient
::设置程序的工作路径,一般为程序主目录,此项若留空,脚本将自行分析路径
set WorkDir=
::设置快捷方式显示的说明(可选)
set Desc=RedisClient
set SoftFile=Redis-Lettuce-Client-1.1.3
if exist %USERPROFILE%\Desktop\%LnkName%.lnk (
del /f /q %USERPROFILE%\Desktop\%LnkName%.lnk
)
if not defined WorkDir call:GetWorkDir "%Program%"
(echo Set WshShell=CreateObject("WScript.Shell"^)
echo strDesKtop=WshShell.SPEcialFolders("DesKtop"^)
echo Set oShellLink=WshShell.CreateShortcut(strDesKtop^&"\%LnkName%.lnk"^)
echo oShellLink.TargetPath="%Program%"
echo oShellLink.WorkingDirectory="%WorkDir%"
echo oShellLink.Windowstyle=1
echo oShellLink.Description="%Desc%"
echo oShellLink.IconLocation = "%curdir%logo.ico"
echo oShellLink.Save)>makelnk.vbs
makelnk.vbs
del /f /q makelnk.vbs
set isExist=0
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %SoftFile%`) do (
echo find process %%a %%b
set isExist=1
set _pid=%%a
set image_name=%%b
)
if "%isExist%"=="1" (
echo %SoftFile% is Running
pause
(echo Set ws=CreateObject("WScript.Shell"^)
echo ws.appactivate %_pid%
echo ws.sendkeys "{ENTER}"
)>openExist.vbs
openExist.vbs
del /f /q openExist.vbs
) else (
cd /d %curdir%
start javaw -jar ./Redis-Lettuce-Client-1.1.3.jar
exit
)
:GetWorkDir
set WorkDir=%~dp1
set WorkDir=%WorkDir:~,-1%
goto :eof
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化