alacritty

Alacritty: run a startup script?


I'm on Windows 10 and trying to run a startup script (vcvars64.bat) to setup the MSVC compiler before using the Alacritty prompt. I have tried the -e switch with the command and also with the alacritty.yml shell: option, but both options open Alacritty, run the command, then exit.

How do I run a script on startup as the first command then continue into Alacritty?

Thanks, Matic


Solution

  • What I ended up with is:

    1. Specify program: cmd.exe in Alacritty alacritty.yml:
      shell:
        program: cmd.exe
      
    2. Create a shortcut to Alacritty.exe and place it eg. in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\ (so that it shows up in Windows search).
    3. In properties for the shortcut, under target, specify:
      "C:\Program Files\Alacritty\alacritty.exe" --command "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat >/NUL" && bash.exe
      
      Modify Visual Studio path to whatever you have, and which varsall.bat you want to use.

    The tricky part was how sensitive cmd.exe is regarding quotes. Eg., it does not work for me to specify an absolute path to which bash.exe to use, it would fail on the first whitespace in the path no matter how I tried to quote it. So make sure the correct bash.exe is first in your PATH (open plain cmd.exe and run where bash.exe to see order). Another solution is of course to create a shortcut to the bash.exe of your liking to a place without spaces in its path then specify it's absolute path (tested to work).