尋找熱鍵的發起者

尋找熱鍵的發起者

如何找到 Windows 熱鍵/捷徑的來源?我知道啟動它的按鍵是Ctrl- Alt-M我知道它運行的程式是Windows資源管理器指向我的文件資料夾。但是要如何找到發起者的位置呢?

我想找到“來源”並從中刪除熱鍵,以便我可以創建另一個。

我們使用的是相當安全的機器,我無法下載任何軟體,所以我需要 Windows 本機的東西來解決問題。

如果這很重要的話,我使用的是 Windows 7 64 位元。

答案1

vbs中有一個wmi查詢列舉所有.lnk快捷方式文件,但它不公開熱鍵屬性。
wscript.shell comobject 可以。
我更喜歡 PowerShell,以下腳本使用在stackoverflow.com
它遞歸整個 C 驅動器以查找 .lnk 檔案並檢查它是否包含熱鍵

## Enum-ShortcutHotkeys.ps1
# Function from Tim Lewis https://stackoverflow.com/a/21967566/6811411
function Get-Shortcut {
  param(
    $path = $null
  )
  $obj = New-Object -ComObject WScript.Shell
  if ($path -eq $null) {
    $pathUser = [System.Environment]::GetFolderPath('StartMenu')
    $pathCommon = $obj.SpecialFolders.Item('AllUsersStartMenu')
    $path = dir $pathUser, $pathCommon -Filter *.lnk -Recurse 
  }
  if ($path -is [string]) {$path = dir $path -Filter *.lnk}
  $path | ForEach-Object { 
    if ($_ -is [string]) {$_ = dir $_ -Filter *.lnk}
    if ($_) {
      $link = $obj.CreateShortcut($_.FullName)
      $info = @{}
      $info.Hotkey = $link.Hotkey
      $info.TargetPath = $link.TargetPath
      $info.LinkPath = $link.FullName
      $info.WorkingDirectory = $link.WorkingDirectory
      $info.Arguments = $link.Arguments
      $info.Target = try {Split-Path $info.TargetPath -Leaf } catch { 'n/a'}
      $info.Link = try { Split-Path $info.LinkPath -Leaf } catch { 'n/a'}
      $info.Description = $link.Description
      $info.WindowStyle = $link.WindowStyle
      $info.IconLocation = $link.IconLocation
      New-Object PSObject -Property $info
    }
  }
}
Get-ChildItem -path c:\ -filter *.lnk -rec -force -EA 0|
  ForEach-Object {
    get-shortcut $_.FullName|where Hotkey
  }

此範例輸出顯示了一個我不知道的 Acronis 熱鍵。

> .\Enum-ShortcutHotkeys.ps1

WorkingDirectory : C:\Program Files (x86)\Acronis\TrueImageHome\
Link             : Acronis System Report.lnk
TargetPath       : C:\Program Files (x86)\Acronis\TrueImageHome\SystemReport.exe
WindowStyle      : 1
Description      : Ermöglicht Ihnen, Informationen über Ihr System zu sammeln.
IconLocation     : ,1
Hotkey           : Ctrl+F7
Target           : SystemReport.exe
Arguments        :
LinkPath         : C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Acronis\True Image\Extras und
                   Werkzeuge\Acronis System Report.lnk

WorkingDirectory : C:\Program Files (x86)\Acronis\TrueImageHome\
Link             : Acronis System Report.lnk
TargetPath       : C:\Program Files (x86)\Acronis\TrueImageHome\SystemReport.exe
WindowStyle      : 1
Description      : Ermöglicht Ihnen, Informationen über Ihr System zu sammeln.
IconLocation     : ,1
Hotkey           : Ctrl+F7
Target           : SystemReport.exe
Arguments        :
LinkPath         : C:\Users\All Users\Microsoft\Windows\Start Menu\Programs\Acronis\True Image\Extras und
                   Werkzeuge\Acronis System Report.lnk

相關內容