先确认进程名
打开软件。
按 Ctrl + Shift + Esc 打开任务管理器。
在“详细信息”标签页找到该软件,查看映像名称。
把主脚本和安装器中所有这个名字替换成正确的。
1. 主脚本
新建文本文件,粘贴下面全部内容,保存为 关闭桌面水印便签主窗口.vbs
[Asm] 纯文本查看 复制代码 ' =============================================
' 桌面水印便签 · 自动关闭主窗口(最终稳定推荐版)
' 进程检查 + 标题激活 双重验证,极简可靠
' =============================================
Option Explicit
Dim WshShell, ret, i, output
Set WshShell = CreateObject("WScript.Shell")
WScript.Sleep 2500 ' 等待软件启动
For i = 1 To 12
' 先检查进程是否存在(快速过滤,避免误操作)
On Error Resume Next
output = WshShell.Exec("tasklist /fi ""imagename eq zhuomianshuiyin.exe"" /nh").StdOut.ReadAll
On Error GoTo 0
If InStr(output, "zhuomianshuiyin.exe") > 0 Then
ret = WshShell.AppActivate("桌面水印便签")
If ret = True Then
WScript.Sleep 180
WshShell.SendKeys "%{F4}"
WScript.Sleep 450
' 确认是否关闭成功
If Not WshShell.AppActivate("桌面水印便签") Then
WScript.Quit 0
End If
End If
End If
WScript.Sleep 800
Next
WScript.Quit 0
2. 一键安装/卸载器
保存为 安装自动关窗.vbs
[Asm] 纯文本查看 复制代码 ' =============================================
' 桌面水印便签自动关窗 · 一键安装/卸载器
' =============================================
Option Explicit
Dim WshShell, FSO, startupPath, scriptPath, scriptName, answer
Set WshShell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
scriptName = "关闭桌面水印便签主窗口.vbs"
startupPath = WshShell.SpecialFolders("Startup") & "\" & scriptName
scriptPath = FSO.GetParentFolderName(WScript.ScriptFullName) & "\" & scriptName
If FSO.FileExists(startupPath) Then
answer = MsgBox("脚本已安装。" & vbCrLf & vbCrLf & "【确定】= 卸载" & vbCrLf & "【取消】= 退出", vbOKCancel + vbQuestion, "卸载确认")
If answer = vbOK Then
FSO.DeleteFile startupPath, True
MsgBox "已成功卸载!", vbInformation, "完成"
End If
Else
Dim content
content = "' =============================================" & vbCrLf & _
"' 桌面水印便签 · 自动关闭主窗口(最终稳定推荐版)" & vbCrLf & _
"' =============================================" & vbCrLf & vbCrLf & _
"Option Explicit" & vbCrLf & _
"Dim WshShell, ret, i, output" & vbCrLf & _
"Set WshShell = CreateObject(""WScript.Shell"")" & vbCrLf & vbCrLf & _
"WScript.Sleep 2500" & vbCrLf & _
"For i = 1 To 12" & vbCrLf & _
" On Error Resume Next" & vbCrLf & _
" output = WshShell.Exec(""tasklist /fi """"imagename eq zhuomianshuiyin.exe"""" /nh"").StdOut.ReadAll" & vbCrLf & _
" On Error GoTo 0" & vbCrLf & _
" If InStr(output, ""zhuomianshuiyin.exe"") > 0 Then" & vbCrLf & _
" ret = WshShell.AppActivate(""桌面水印便签"")" & vbCrLf & _
" If ret = True Then" & vbCrLf & _
" WScript.Sleep 180" & vbCrLf & _
" WshShell.SendKeys ""%{F4}""" & vbCrLf & _
" WScript.Sleep 450" & vbCrLf & _
" If Not WshShell.AppActivate(""桌面水印便签"") Then WScript.Quit 0" & vbCrLf & _
" End If" & vbCrLf & _
" End If" & vbCrLf & _
" WScript.Sleep 800" & vbCrLf & _
"Next" & vbCrLf & _
"WScript.Quit 0"
FSO.CreateTextFile(scriptPath, True).Write content
FSO.CopyFile scriptPath, startupPath, True
MsgBox "安装成功!" & vbCrLf & vbCrLf & "重启后主窗口将自动关闭。", vbInformation, "完成"
End If
Set FSO = Nothing
Set WshShell = Nothing
WScript.Quit 0
3、如果觉得以上两个脚本用起来麻烦,再补一个单脚本的
新建一个文本文档,把下面全部内容复制进去,然后保存为:
桌面水印便签自动关闭.vbs
[Asm] 纯文本查看 复制代码 ' =============================================
' 桌面水印便签 · 单个合体版自动关闭主窗口
' 安装/卸载 + 开机自动关闭 合二为一
' =============================================
Option Explicit
Dim WshShell, FSO, startupPath, currentPath, scriptName, answer
Set WshShell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
scriptName = "桌面水印便签自动关闭.vbs"
startupPath = WshShell.SpecialFolders("Startup") & "\" & scriptName
currentPath = WScript.ScriptFullName
' ==================== 判断运行环境 ====================
' 如果是从开机启动文件夹运行的 → 执行关闭窗口功能(静默模式)
If LCase(currentPath) = LCase(startupPath) Then
Call CloseMainWindow
WScript.Quit 0
End If
' ==================== 双击运行 → 安装/卸载界面 ====================
If FSO.FileExists(startupPath) Then
answer = MsgBox("脚本已安装在开机启动项中。" & vbCrLf & vbCrLf & _
"【确定】 = 卸载(以后不再自动关闭窗口)" & vbCrLf & _
"【取消】 = 什么都不做", vbOKCancel + vbQuestion, "桌面水印便签自动关闭")
If answer = vbOK Then
FSO.DeleteFile startupPath, True
MsgBox "已成功卸载!", vbInformation, "完成"
End If
Else
' 复制自身到启动文件夹
FSO.CopyFile currentPath, startupPath, True
MsgBox "安装成功!" & vbCrLf & vbCrLf & _
"下次重启电脑后,桌面水印便签的主窗口将自动关闭。" & vbCrLf & _
"水印功能和托盘图标不受影响。", vbInformation, "安装完成"
End If
Set FSO = Nothing
Set WshShell = Nothing
WScript.Quit 0
' =============================================
' 核心功能:自动关闭主窗口(仅在开机启动时执行)
' =============================================
Sub CloseMainWindow()
Dim WshShell, ret, i, output
Set WshShell = CreateObject("WScript.Shell")
WScript.Sleep 2500 ' 等待软件启动
For i = 1 To 12
' 双重验证:先检查进程是否存在
On Error Resume Next
output = WshShell.Exec("tasklist /fi ""imagename eq zhuomianshuiyin.exe"" /nh").StdOut.ReadAll
On Error GoTo 0
If InStr(output, "zhuomianshuiyin.exe") > 0 Then
ret = WshShell.AppActivate("桌面水印便签")
If ret = True Then
WScript.Sleep 180
WshShell.SendKeys "%{F4}"
WScript.Sleep 450
' 确认是否关闭成功
If Not WshShell.AppActivate("桌面水印便签") Then
Exit Sub
End If
End If
End If
WScript.Sleep 800
Next
End Sub
使用方法:
把上面代码保存为 桌面水印便签自动关闭.vbs
双击这个文件 , 它会自动复制自己到开机启动文件夹并提示“安装成功”
重启电脑测试
以后如果想卸载 → 再次双击这个文件 → 选择确定卸载
|