Você provavelmente poderia fazer isso com AutoHotKey .
Por exemplo, digamos que você queira que o atalho Win + S lance MyScript
. Instale o AutoHotKey, copie o seguinte para o arquivo AutoHotkey.ahk e reinicie o AutoHotKey:
SetTitleMatchMode RegEx
return
; Stuff to do when Windows Explorer is open
;
#IfWinActive ahk_class ExploreWClass|CabinetWClass
#s::
LaunchMyScriptInCurrent()
return
#IfWinActive
; Launches a custom script in the directory browsed in Explorer.
; Note: expecting to be run when the active window is Explorer.
;
LaunchMyScriptInCurrent()
{
; This is required to get the full path of the file from the address bar
WinGetText, full_path, A
; Split on newline ('n)
StringSplit, word_array, full_path, 'n
; Take the first element from the array
full_path = %word_array1%
; strip to bare address
full_path := RegExReplace(full_path, "^Address: ", "")
; Just in case - remove all carriage returns ('r)
StringReplace, full_path, full_path, 'r, , all
IfInString full_path, \
{
Run, C:\Path\To\MyScript "%full_path%"
}
else
{
Run, C:\Path\To\MyScript "C:\ "
}
}
Inspirado nessas duas respostas: