On my windows desktop I have a folder called Links with one file: Firefox.lnk
I manually set a hotkey "CTRL+SHIFT+F" for this shortcut and everything worked as expected.
But after a reboot my hotkey "CTRL+SHIFT+F" does not work any more.
Manually setting the hotkey back to "" and then back to "CTRL+SHIFT+F" makes it work again.
But planning to put more files into this folder - the manual solution was not an option - so my plan was to set all shortcut hotkeys to an empty string via a powershell script and then run the following script to set all hotekeys to "CTRL+SHIFT+FirstletterOfShortcutFileName".
The first script sets the hotkey back to "" (manual check) and after running the following script the hotkey of the firefox shortcut was set to "CTRL+SHIFT+F". But unfortunately the hotkey does not work. How can I make it work?
$lnkfiles = Get-ChildItem -Path "C:\Users\xxx\Desktop\Links\" -Filter *.lnk
foreach($lnkfile in $lnkfiles){
$sh = New-Object -COM WScript.Shell
$targetPath = $sh.CreateShortcut($lnkfile.FullName)
$fileName = Split-Path $targetPath.FullName -leaf
$firstLetter = $fileName[0]
$targetPath.HotKey = "CTRL+SHIFT+" + $firstLetter
$targetPath.Save()
}
.HotKeyworks only for shortcuts on your desktop (does not in a subfolder of the desktop).