背景:经常错过消息,微信又没有QQ一样的弹出框,因此自己做了个简单的
测试环境:WIN10+微信3.9.0.28
使用方法:右键管理员运行,先输入微信设置|文件管理中的路径,再输入微信.lnk路径即微信快捷方式路径,然后就可以用了
@echo off
setlocal enabledelayedexpansion
echo 电脑版微信新信息提示工具
echo.
echo 作者:phenix
echo.
echo 邮箱:279682817@qq.com
echo.
for /f "tokens=* delims=" %%m in ('dir /b %temp%^|find "msg_"') do (
del /q %temp%\%%m>nul
)
set wechat_root=
set wechat_file=
:main
if "!wechat_root!" equ "" (
set /p wechat_root=请输入聊天记录的主目录,以\WeChat Files\结尾,直接\为默认微信聊天记录目录:
set /p wechat_lnk=请输入微信快捷方式文件路径,以\微信.lnk结尾:
if "!wechat_root!" equ "\" (
set wechat_root=%USERPROFILE%\Documents\WeChat Files\
) else (
if not exist "!wechat_root!" (
echo 设置的聊天记录主目录不存在!请重新设置!
set wechat_root=
goto :main
)
)
)
echo msgbox "您有新的未查看的微信消息!">%temp%\msg.vbs
echo wscript.echo "暂无新的未查看的微信消息!">%temp%\nomsg.vbs
rem echo wscript.sleep 1000*10>%temp%\sleep1.vbs
set msg_flag=0
set idx=1
for /f "tokens=* delims=" %%a in ('dir /b "!wechat_root!"^|find "wxid_"') do (
set wechat_dir=%%a
if "!wechat_file!" equ "" (
set dbIdx=1
for /f "tokens=* delims=" %%x in ('dir /b /o-n /tw "!wechat_root!\!wechat_dir!\Msg\Multi\"^|findstr /R "\<FTSMSG.*\.db-wal"') do (
if !dbIdx! equ 1 (
rem echo %%x
set wechat_file=Msg\Multi\%%x
)
set /a dbIdx+=1
)
)
set wechat_fullpath=!wechat_root!\!wechat_dir!\!wechat_file!
if exist "!wechat_fullpath!" (
set msg_startlen=
set msg_endlen=
if exist %temp%\msg_len_!idx!.txt (
set /p msg_startlen=<%temp%\msg_len_!idx!.txt
for /f "tokens=* delims=" %%1 in ('"powershell -command (ls ^'!wechat_fullpath!^').LastAccessTimeUtc"') do (
set msg_endlen=%%1
echo !msg_endlen!>%temp%\msg_len_!idx!.txt
rem echo !msg_startlen!
rem echo !msg_endlen!
)
) else (
for /f "tokens=* delims=" %%1 in ('"powershell -command (ls ^'!wechat_fullpath!^').LastAccessTimeUtc"') do (
echo %%1>%temp%\msg_len_!idx!.txt
)
)
if "!msg_startlen!" neq "!msg_endlen!" (
rem start /wait /b cscript /nologo %temp%\sleep1.vbs
set startdate=
set enddate=
if exist %temp%\msg_date_!idx!.txt (
for /f "tokens=* delims=" %%1 in (%temp%\msg_date_!idx!.txt) do (
set startdate=%%1
)
for /f "tokens=* delims=" %%1 in ('"powershell -command (ls ^'!wechat_lnk!^').LastAccessTimeUtc"') do (
set enddate=%%1
echo !enddate!>%temp%\msg_date_!idx!.txt
)
rem echo !startdate!
rem echo !enddate!
) else (
for /f "tokens=* delims=" %%1 in ('"powershell -command (ls ^'!wechat_lnk!^').LastAccessTimeUtc"') do (
echo %%1>%temp%\msg_date_!idx!.txt
)
)
if "!startdate!" equ "!enddate!" (
start !wechat_lnk!
for /f "tokens=* delims=" %%1 in ('"powershell -command (ls ^'!wechat_lnk!^').LastAccessTimeUtc"') do (
echo %%1>%temp%\msg_date_!idx!.txt
)
set msg_flag=1
)
) else (
for /f "tokens=* delims=" %%1 in ('"powershell -command (ls ^'!wechat_lnk!^').LastAccessTimeUtc"') do (
echo %%1>%temp%\msg_date_!idx!.txt
)
)
)
set /a idx+=1
)
if !msg_flag! equ 0 (
cscript /nologo %temp%\nomsg.vbs
)
rem start /wait /b cscript /nologo %temp%\sleep1.vbs
goto :main
(全文完)