Often need to use the remote server graphics tools, if the Windows side useless xserver, many programs can not run. For a special example, Emacs is opened directly in the terminal when no xserver is used, if the Cygwin.bat file is not modified. nonsense less, download install Cygwin x11 related package. After loading, there is a Startxwin.bat file under C:\cygwin\usr\X11R6\bin, comment out %run% xterm-e/usr/bin/bash-l this line. Each time you open this script file later, you do not have to eject annoying xterm, and xserver will automatically minimize the system tray. But every time we have to manually point this batch of processing script, very troublesome, so try to write Cygwin.bat with Cygwin terminal to run together. However, another problem, after starting Cygwin, if the shell is closed, then Xserver is still running, the next time you open this script, the Xserver has run errors. You then need to add a judgment: if Xserver is already running, then the Startxwin.dat script is not called, otherwise called. but again, after adding this judgment, if Xserver is started, turn the shell back on after you close the shell, Discover that Emacs is re-opened inside the shell instead of a popup window, bug? then modifies the processing of the judgment: if Xserver is already running, kill the process. This way, regardless of whether Xserver is running, the Cygwin.bat script will be called Startxwin.dat script, Emacs and other programs are useless:) after modifying the Cygwin.bat script as follows: @echo Off set Cygwin=binmode TTY ntsec c: for/f%%i in (' TasklisT ') do if/i%%i==xwin.exe (taskkill/im xwin.exe/f) call c:\cygwin\usr\x11r6\bin\startxwin.bat ChDir C:\cygwin\bin bash--login-i The second line is to prevent windowless Emacs from opening in the shell from exiting. Line four is to determine if the process containing xserver is processed, and the fifth line is to call the Startxwin.dat script. after such a toss, found that even DOS batch processing is so good, you can think of the Linux shell how powerful, to learn Shell programming!!!
Automatic operation of X-server for Cygwin and related script modifications