Automatic operation of the x-server of Cygwin and related script modifications

Source: Internet
Author: User

  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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.