0

I have the following AHK script in my startup folder, there's also a few shortcuts before this, they work but this bit doesn't, any idea why I can't startup my dev environment on windows startup?

; if conemu's not running, start vagrant & cmder (conemu) on startup (or script re-start)
Process,Exist,ConEmu.exe
{ 
   If !errorlevel
   {
        RunWait "%comspec% /C vagrant up", C:\vagrant\ubuntu, Hide,
        Run "C:\cmder\Cmder.exe", "", Max
        return
    } else {
        return
    }
}

According to what I've read elsewhere, this is how it's done & I'm not sure why it doesn't work

EDIT: I've moved my code as suggested by @user3419297 below, it works better now, but it still doesn't work as expected. I get the following error:

Error: Failed attempt to launch program or document:
Action: <C:\WINDOWS\system32\cmd.exe /C vagrant up>
Params: <>

Specifically: The system cannot find the file specified

which is referencing RunWait "%comspec% /C vagrant up", C:\vagrant\ubuntu, Hide,

How would I run the vagrant up command in the correct folder using cmd.exe?

1
  • RunWait "%comspec% /C C:\vagrant\ubuntu\vagrant up", C:\vagrant\ubuntu, Hide,
    – JJohnston2
    Commented May 16, 2016 at 0:58

1 Answer 1

1

Any lines you want to execute immediately when the script starts should appear at the top of the script, prior to the first hotkey, hotstring, or Return. For details, see auto-execute section. https://autohotkey.com/docs/FAQ.htm#autoexec

2
  • Thanks, @user3419297, I've moved the bit of code to the auto-execute section, but it still won't run vagrant up, would you be so kind as to take a second look at my edited question?
    – JKirchartz
    Commented May 15, 2016 at 20:40
  • Read autohotkey.com/docs/commands/Run.htm#Remarks how to run a program via Comspec.
    – Relax
    Commented May 15, 2016 at 22:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .