Skip to content

Instantly share code, notes, and snippets.

@baztian
Forked from Shade30/emacs-run.bat
Last active May 13, 2020 00:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baztian/622b827212a06787c525d52dc9acee6f to your computer and use it in GitHub Desktop.
Save baztian/622b827212a06787c525d52dc9acee6f to your computer and use it in GitHub Desktop.
Cygwin emacs-w32 wrapper. Allows to run emacs with arguments directly from windows.
@echo off
Setlocal EnableDelayedExpansion
set CYGDIR=C:\cygwin64
set CYGBINDIR=%CYGDIR%\bin
set PATH=%PATH%;%CYGBINDIR%;%CYGDIR%\usr\local\bin;%CYGDIR%\usr\bin
cd /d %CYGDIR%\home\%USERNAME%
if [%1]==[] goto BLANK
set VAR=
for /f %%i in ('%CYGBINDIR%\cygpath.exe %*') do set VAR=!VAR! %%i
echo %VAR%
start %CYGBINDIR%\mintty.exe -i /bin/emacs.ico -w hide /bin/bash --login -c "/bin/emacsclient --alternate-editor=/bin/emacs %VAR%"
goto DONE
:BLANK
start %CYGBINDIR%\mintty.exe -i /bin/emacs.ico -w hide /bin/bash --login -c "/bin/emacsclient --alternate-editor=/bin/emacs -c"
goto DONE
:DONE
@xbelanch
Copy link

xbelanch commented Jul 7, 2019

You saved my day Thanks!

@baztian
Copy link
Author

baztian commented Jul 8, 2019

Thanks @xbelanch. Glad that it is helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment