前言
野路子网管一枚,写的不好勿喷,手动执行方法参考https://www.cnblogs.com/journeyonmyway/p/11286276.html。
环境准备
操作环境: win10 1903/2004下的cmd , 按下windows键搜索“cmd”右键管理员运行。
使用工具: handle.exe
工具下载: https://download.csdn.net/download/woodvk/12863950
手动执行过程
用cmd进入handle所在的文件夹
打开cmd后,输入cd /d I:\Downloads\Handle回车,看到切到相应目录后即可。
C:\Users\test>cd /d I:\Downloads\Handle
I:\Downloads\Handle>
查找需要关闭的句柄
运行handle.exe -a "BaseNamedObjects{{239B7D43-86D5-4E5C-ADE6-CEC42155B475}}DingTalk
执行结果如下:
I:\Downloads\Handle>handle.exe -a "BaseNamedObjects\{{239B7D43-86D5-4E5C-ADE6-CEC42155B475}}
Nthandle v4.22 - Handle viewer
Copyright (C) 1997-2019 Mark Russinovich
Sysinternals - www.sysinternals.com
DingTalkRC.exe pid: 9260 type: Mutant 254: \Sessions\1\BaseNamedObjects\{{239B7D43-86D5-4E5C-ADE6-CEC42155B475}}DingTalkRC
DingTalkRC.exe pid: 9260 type: Mutant 264: \Sessions\1\BaseNamedObjects\{{239B7D43-86D5-4E5C-ADE6-CEC42155B475}}DingTalkRC_loginframe
DingTalk.exe pid: 12220 type: Mutant 42C: \Sessions\1\BaseNamedObjects\{{239B7D43-86D5-4E5C-ADE6-CEC42155B475}}DingTalk_loginframe
DingTalk.exe pid: 12220 type: Mutant 430: \Sessions\1\BaseNamedObjects\{{239B7D43-86D5-4E5C-ADE6-CEC42155B475}}DingTalk
我这个比较多是因为我开了钉钉RC版。
关闭防多开句柄
关闭pid:12220 下的42C、430句柄
handle.exe -p 12220 -c 42C -y
handle.exe -p 12220 -c 430 -y
42C: Mutant \Sessions\1\BaseNamedObjects\{{239B7D43-86D5-4E5C-ADE6-CEC42155B475}}DingTalk_loginframe
Handle closed.
430: Mutant \Sessions\1\BaseNamedObjects\{{239B7D43-86D5-4E5C-ADE6-CEC42155B475}}DingTalk
Handle closed.
完成后再打开钉钉主程序即可双开,重复执行可以多开。
如何用批处理自动获取pid、句柄值
我们先把查询到信息存到txt里
handle.exe -a "BaseNamedObjects\{{239B7D43-86D5-4E5C-ADE6-CEC42155B475}}DingTalk" > 1.txt
DingTalk.exe pid: 16288 type: Mutant 424: \Sessions\1\BaseNamedObjects\{{239B7D43-86D5-4E5C-ADE6-CEC42155B475}}DingTalk_loginframe
DingTalk.exe pid: 16288 type: Mutant 428: \Sessions\1\BaseNamedObjects\{{239B7D43-86D5-4E5C-ADE6-CEC42155B475}}DingTalk
再用for循环进行取值,先去掉:
for /f "tokens=2,3 delims=:" %i in (1.txt) do ( echo %i %j >> 2.txt )
D:\auto\DD-Double>for /F "tokens=2,3 delims=:" %i in (1.txt) do (echo %i %j 1>>2.txt )
D:\auto\DD-Double>(echo 12220 type Mutant 42C 1>>2.txt )
D:\auto\DD-Double>(echo 12220 type Mutant 430 1>>2.txt )
再执行一次for循环取出pid、句柄值,用handle -p pid -c 句柄值 -y 干掉相应句柄
for /f "tokens=1,4 delims= " %i in (2.txt) do ( echo %i %j >> 3.txt && handle.exe -p %i -c %j -y)
D:\auto\DD-Double>for /f "tokens=1,4 delims= " %i in (2.txt) do ( echo %i %j >> 3.txt && handle.exe -p %i -c %j -y)
D:\auto\DD-Double>(echo 16288 424 1>>3.txt && handle.exe -p 16288 -c 424 -y )
Nthandle v4.22 - Handle viewer
Copyright (C) 1997-2019 Mark Russinovich
Sysinternals - www.sysinternals.com
424: Mutant \Sessions\1\BaseNamedObjects\{{239B7D43-86D5-4E5C-ADE6-CEC42155B475}}DingTalk_loginframe
Handle closed.
D:\auto\DD-Double>(echo 16288 428 1>>3.txt && handle.exe -p 16288 -c 428 -y )
Nthandle v4.22 - Handle viewer
Copyright (C) 1997-2019 Mark Russinovich
Sysinternals - www.sysinternals.com
428: Mutant \Sessions\1\BaseNamedObjects\{{239B7D43-86D5-4E5C-ADE6-CEC42155B475}}DingTalk
Handle closed.
最后运行钉钉主程序即可
"C:\Program Files (x86)\DingDing\DingtalkLauncher.exe"
最后上可以直接用的代码
复制保存到钉钉多开.bat即可。
另下载handle工具那块需要改下,因为没有直接公网用的下载地址。
@echo off
echo 正在检测管理员权限
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
set workpath=d:\auto\DD-Double
dir %workpath% >nul 2>nul
if /i "%errorlevel%" == "1" mkdir %workpath%
pushd %workpath%
dir handle.exe > nul 2>nul
if /i "%errorlevel%" == "1" echo 未检测到handle,正在下载handle工具 && powershell (new-object System.Net.WebClient).DownloadFile( 'http://localhost','%workpath%\handle.exe')
echo 如无报错,初始化完毕
pause
:main
cls
title 主界面
rem 主界面
echo=
echo=
echo=
echo 1、钉钉版
echo 2、钉钉RC版
echo=
echo=
echo 适配win10 1903,其他版本自行测试
echo 使用钉钉版会顺带关闭RC版的句柄,不优化了
echo=
echo=
set leixing=
set /p leixing=请选择类型:
if /i "%leixing%" == "1" goto DD
if /i "%leixing%" == "2" goto DDRC
goto main
:DD
::@echo on
set name1=DingTalk
set name2=DingDing
goto Double
:DDRC
::@echo on
set name1=DingTalkRC
set name2=DingDingRC
goto Double
:Double
handle.exe -a "BaseNamedObjects\{{239B7D43-86D5-4E5C-ADE6-CEC42155B475}}%name1%" > 1.txt
del 2.txt
del 3.txt
for /f "tokens=2,3 delims=:" %%i in (1.txt) do (
echo %%i %%j >> 2.txt
)
for /f "tokens=1,4 delims= " %%i in (2.txt) do (
echo %%i %%j >> 3.txt
handle.exe -p %%i -c %%j -y
)
echo 显示Handle closed.则成功
"C:\Program Files (x86)\%name2%\DingtalkLauncher.exe"
pause