Wie finde ich die Quelle eines Windows-Hotkeys/einer Windows-Verknüpfung? Ich weiß, dass die Tasten, mit denen er gestartet wird Ctrl, - sind Altund Mich weiß, dass das Programm, das er ausführt, istWindows Explorerverwies auf dieMeine DokumenteOrdner. Aber wie finde ich den Standort des Absenders?
Ich möchte die „Quelle“ finden und den Hotkey daraus entfernen, damit ich einen anderen erstellen kann.
Wir verwenden relativ sichere Rechner und ich kann keine Software herunterladen. Daher brauche ich zur Lösung des Problems eine native Windows-Version.
Ich verwende Windows 7 (64 Bit), falls das wichtig ist.
Antwort1
Es gibt eine WMI-Abfrage in VBS, die alle .lnk-Verknüpfungsdateien auflistet, aber die Hotkey-Eigenschaft nicht verfügbar macht.
Das wscript.shell-Comobject tut dies.
Ich bevorzuge PowerShell, das folgende Skript verwendet eine Funktion, die aufstackoverflow.com.
Es durchsucht das gesamte Laufwerk C nach .lnk-Dateien und prüft, ob diese einen Hotkey enthalten
## 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
}
Diese Beispielausgabe enthüllte einen Acronis-Hotkey, den ich nicht kannte.
> .\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