<# :
@echo off
powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((Get-Content '%~f0') -join [Environment]::NewLine)"
exit /b
#>
$Signature = @'
[DllImport("user32.dll")]
public static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, uint dwExtraInfo);
'@
$Win32Keyboard = Add-Type -MemberDefinition $Signature -Name "Win32Keyboard" -Namespace "Win32" -PassThru
$VK_LALT = 0xA4 # Left Alt
$VK_LWIN = 0x5B # Left Windows
$KEYEVENTF_KEYUP = 0x0002
$Win32Keyboard::keybd_event($VK_LALT, 0, 0, 0)
$Win32Keyboard::keybd_event($VK_LWIN, 0, 0, 0)
$Win32Keyboard::keybd_event($VK_LWIN, 0, $KEYEVENTF_KEYUP, 0)
$Win32Keyboard::keybd_event($VK_LALT, 0, $KEYEVENTF_KEYUP, 0)
I know that it is possible to call SystemTrayMenu from the windows tray (next to the clock). But it's much more familiar to me to do this from the "Quick Launch" menu, which is located in windows Explorer along the way. C:\Users\user\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch. I would like to create a shortcut there to run SystemTrayMenu.
I have now implemented this using a vbs+bat script. To simulate pressing LeftAlt + Win, I set this combination to open the SystemTrayMenu menu.
LeftAlt + Win.vbs
LeftAlt + Win.bat
However, it seems to me that this is not the best option.
Is it possible to access the SystemTrayMenu menu from a windows shortcut without creating workarounds in the form of simulating keyboard keystrokes?
Or at least implement a call from the command line (bat script) using arguments.