Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alacritty: run a startup script?

Tags:

alacritty

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

like image 754
12 revs, 3 users 92% Avatar asked Aug 04 '26 11:08

12 revs, 3 users 92%


1 Answers

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).

like image 96
helmesjo Avatar answered Aug 07 '26 12:08

helmesjo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!