简介

AIDA64 传感器面板有时会以错误的位置或大小打开,尤其是在多显示器设置中。该Watcher系统确保面板始终以正确的位置和大小打开,使用主.ini文件作为参考。

特色:

  • Windows启动时自动运行
  • 每隔几秒监控一次AIDA64.ini文件
  • 修正 SensorPanel 窗口的位置和大小
  • 在背景中静静运行

该系统使用:

  • 主.ini文件——你的参考配置
  • PowerShell Watcher 脚本——监控.ini文件并修复窗口
  • 隐藏的VBS启动器——以管理员权限静默运行批处理
  • 可选批处理文件——复制主.ini文件并重启AIDA64

步骤1:准备主文件.ini

  1. 创建一个文件夹来存储你的参考.ini文件。示例:
C:\Path\To\Master\aida64.ini
  1. 将您想要的AIDA64.ini文件复制到此文件夹中。这是观察者将用作参考的文件。

步骤2:创建批处理文件

  1. 打开记事本粘贴:
@echo off
taskkill /f /im aida64.exe >nul 2>&1
timeout /t 5 /nobreak >nul
copy /y "C:\Path\To\Master\aida64.ini" "C:\Program Files\FinalWire\AIDA64 Extreme\aida64.ini" >nul
start "" "C:\Program Files\FinalWire\AIDA64 Extreme\aida64.exe"
  1. 保存为AIDA64_Fixed_SensorPanel.bat。

注意:用你的主.ini文件路径和AIDA64安装文件夹替换路径。


步骤3:创建隐藏的VBS启动器

  1. 打开记事本粘贴:
Set objShell = CreateObject("Shell.Application")
If WScript.Arguments.Length = 0 Then
    objShell.ShellExecute "wscript.exe", """" & WScript.ScriptFullName & """ runas", "", "runas", 1
    WScript.Quit
End If
batPath = "C:\Path\To\Watcher\AIDA64_Fixed_SensorPanel.bat"
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run """" & batPath & """", 0, False
  1. 保存为 AIDA64_Fixed_SensorPanel_Hidden.vbs。

注意:将batPath替换为你的批处理文件路径。


步骤4:创建PowerShell Watcher脚本

  1. 打开记事本粘贴:
$master = "C:\Path\To\Master\aida64.ini"
$install = "C:\Program Files\FinalWire\AIDA64 Extreme\aida64.ini"
$vbs = "C:\Path\To\Watcher\AIDA64_Fixed_SensorPanel_Hidden.vbs"
$SensorPanelClass = "TForm_HWMonitoringSensorPanel"

if (-not ("WinAPI" -as [type])) {
Add-Type @"
using System;
using System.Runtime.InteropServices;
using System.Text;
public class WinAPI {
    public delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
    [DllImport("user32.dll")]
    public static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam);
    [DllImport("user32.dll", SetLastError=true)]
    public static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
    [DllImport("user32.dll")]
    public static extern bool IsWindowVisible(IntPtr hWnd);
    [DllImport("user32.dll")]
    public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
}
"@
}

$global:foundHandles = @()

function Get-FileHashMD5($file) {
    if (Test-Path $file) { return (Get-FileHash $file -Algorithm MD5).Hash } else { return "" }
}

function Fix-SensorPanel {
    $global:foundHandles = @()
    $callback = {
        param($hWnd, $lParam)
        if ([WinAPI]::IsWindowVisible($hWnd)) {
            $classSb = New-Object System.Text.StringBuilder 256
            [WinAPI]::GetClassName($hWnd, $classSb, $classSb.Capacity) | Out-Null
            if ($classSb.ToString() -eq $SensorPanelClass) { $global:foundHandles += $hWnd }
        }
        return $true
    }
    $delegate = [WinAPI+EnumWindowsProc]$callback
    [WinAPI]::EnumWindows($delegate, [IntPtr]::Zero) | Out-Null
    foreach ($hWnd in $global:foundHandles) {
        for ($i=0; $i -lt 10; $i++) {
            [WinAPI]::MoveWindow($hWnd, -1280, 1040, 1280, 400, $true)
            Start-Sleep -Milliseconds 200
        }
    }
}

while ($true) {
    if (Get-FileHashMD5($master) -ne Get-FileHashMD5($install)) {
        Start-Process "wscript.exe" -ArgumentList ('"' + $vbs + '"') -Verb RunAs
    }
    Fix-SensorPanel
    Start-Sleep -Seconds 5
}
  1. 保存为AIDA64_Watcher.ps1。

注意:更新主.ini文件、安装文件夹和VBS文件的路径。


步骤5:创建隐藏的计划任务

  1. 开放任务调度器(Win + S →任务调度器)
  2. 点击创建任务......
  3. 一般标签:
    • 名称:AIDA64 传感器面板观察员
    • 仅在用户登录时才检查运行
    • 最高权限的检验运行
    • 配置对象:Windows 10
  4. 触发标签页:
    • 新→开始任务:登录时 → OK
  5. 操作标签:
    • 新→行动:启动一个项目
    • 程序/脚本:powershell.exe
    • 补充论点:

-WindowStyle 隐藏 -执行策略绕过 -文件 “C:\Path\To\Watcher\AIDA64_Watcher.ps1”

  1. 设置标签:
    • 允许任务按需运行
    • 错过启动后尽快执行任务
    • 如果失败,重启任务(间隔1分钟,3次尝试)
  2. 点击确定 → 如有要求输入密码

工作原理

  • 观察者会将已安装的.ini文件与主.ini文件进行比对
  • 如果检测到差异,它会静默运行批处理文件以更新AIDA64
  • PowerShell脚本通过类名搜索传感器面板窗口
  • 把它移到正确的显示器并调整大小
  • 后台隐形运行,资源消耗极低

资源使用:

  • Watcher 使用最小的 CPU 和内存(通常为 <5 MB 内存,CPU 可忽略不计)。

免责声明

文本是用ChatGPT生成的,因为英语不是我的母语。强烈建议在编辑任何内容前创建一个Windows系统还原点。对于意外故障不承担责任;使用请自行承担风险。

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。