Windows Batch File to start xterm on Cygwin/X 1.7.x

Zheng-Da Tan
Mon Jan 25 22:53:00 GMT 2010

I like to have one icon in Windows that I can click on to open a new
xterm window:
   - if the X server is not running, the icon would start X and launch
a xterm window
   - if the X server is running, it will simply open a new xterm
window on the existing X server

This was how it used to work by default in a very old version of
Cygwin.  It had been broken once before (search silent-dup-error in
the mailing list archives), fixed, and now broken again when
startxwin.bat became startxwin.exe.  So I've put together this batch
file that makes things work again on the latest version of Cygwin

$ cat startCygwinX.bat

SET RUN=%CYGWIN_ROOT%\bin\run -p /usr/bin

tasklist | \WINDOWS\system32\find.exe "XWin.exe"
if errorlevel 1 (
%RUN% bash.exe -l -c startxwin.exe
) ELSE (
%RUN% xterm -sb -rightbar -bg black -fg white +tb -sl 1000 -e /usr/bin/bash -l

Point a Windows icon to this batch file above, and you have one icon
to do it all.

I hope this is helpful to someone out there!

Best regards,


Unsubscribe info:
Problem reports:

More information about the Cygwin-xfree mailing list