bat File to Launch Remote X11 Application

Takashi Yano
Tue Nov 23 00:07:28 GMT 2021

On Mon, 22 Nov 2021 14:15:32 -0500
Dennis Putnam wrote:
> I have a remote X application on a Linux system that I want to launch 
> with a Windows bat file. My main problem is how to determine if Cygwin/X 
> is running and if not launch it. Once verified I think all I need to do 
> is use SSH -Y with the command that starts the X application. Can 
> someone help? TIA.

What about something like:

set DISPLAY=:0
for /f "usebackq delims=" %%A in (`tasklist ^|find /C "XWin"`) do if %%A==0 start C:\cygwin64\bin\XWin %DISPLAY% -multiwindow
c:\cygwin64\bin\ssh -Y xterm

Note that the above bat fails to start XWin if it is already
started with DISPLAY other than :0.

Takashi Yano <>

More information about the Cygwin mailing list