Windowsのホットキー/ショートカットのソースを見つけるにはどうすればいいですか?起動するキーはCtrl- Alt-であることはわかっていますMし、実行するプログラムもわかっています。Windowsエクスプローラ指摘した私の文書フォルダー。しかし、発信元の場所を見つけるにはどうすればよいでしょうか?
「ソース」を見つけて、そこからホットキーを削除し、別のホットキーを作成できるようにしたいと思います。
私たちはかなり安全なマシンを使用しており、ソフトウェアをダウンロードすることはできないため、問題を解決するには Windows ネイティブのものが必要です。
関係があるかどうかはわかりませんが、私は Windows 7 64 ビットを使用しています。
答え1
vbsには、すべての.lnkショートカットファイルを列挙するwmiクエリがありますが、ホットキープロパティを公開しません。wscript.shell
comobjectは公開します。
私はPowerShellを好みます。次のスクリプトは、出典:.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