command-lineautoithotkeys

How to set a hotkey to run a command line?


I want SHIFT + Numpad + to run command line:

"C:\Program Files\foo\bar.exe" -path "F:\something\dir\blah\"

Solution

  • As per

    Global Const $g_sKey = '+{NUMPADADD}', _
                 $g_sCmd = FileGetShortName("C:\Program Files\foo\bar.exe") & ' -path "F:\something\dir\blah"'
    
    HotKeySet($g_sKey, RunCmd)
    
    While True
    
        Sleep(0)
    
    WEnd
    
    Func RunCmd()
    
        RunWait(@ComSpec & ' /c ' & $g_sCmd)
    
    EndFunc