windowsautohotkeycmder

How to create AutoHotKey which starts script (i.e .bat) using Cmder command line arguments?


I am trying to create an autohotkey which starts a script (i.e .bat):

#!g::
  Run "Path\To\script\script.bat" debug
  Return

The AutoHotKey works properly. However, I would like the .bat to be opened using Cmder instead of the default windows cmd.

I tried to set the Cmder as the default cmd by going to Settings-> Integration -> Default term and by checking the "Force ConEmu as default terminal for console applications", but this did not change anything in my particular case, and the script is still being ran in windows cmd.


Solution

  • Assuming Cmder can take a command line parameter, make it explicit:

    Run "Path\To\exe\Cmder.exe Path\To\script\script.bat" debug

    Else, run Cmder and then use AHK to file open the script.

    EDIT: Based on OP's solution, could try:

    Run "Path\To\exe\Cmder.exe /Task ""Path\To\script\script.bat debug"""

    or

    Run "Path\To\exe\Cmder.exe /Start ""Path\To\script"" /Task ""script.bat debug"""

    The exact syntax and whether and where to surround things with quotes is tbd, but try and see.