This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Windows Shortcut That Runs Cygwin Command


Panos, I don't have Windows 7, however, this procedure is generic
enough that it should work.  Try it and let me know.

1. Create this plain DOS .cmd file in
c:\cygwin\usr\local\bin\dos2cygwin.cmd.  Line endings should be CRLF
so it may be best to create this with Notepad.

@echo off
echo.
echo.-------------------------------------------------------------------------------
echo.Welcome to the DOS batch file dos2cygwin.cmd
echo.-------------------------------------------------------------------------------
echo.
REM Ping below provides a time delay like the sleep command
ping -n 5 127.0.0.1 > nul:
echo.About to run the dos2cygwin.sh BASH script.....
echo.
REM Ping below provides a time delay like the sleep command
ping -n 5 127.0.0.1 > nul:
@echo on
bash -c "export LANG=C ; /usr/local/bin/dos2cygwin.sh"
@echo off
echo.
echo.Back in the batch file after running /usr/local/bin/dos2cygwin.sh
echo.
REM Ping below provides a time delay like the sleep command
ping -n 5 127.0.0.1 > nul:
echo.
echo.-------------------------------------------------------------------------------
echo.Goodbye from the DOS batch file dos2cygwin.cmd
echo.-------------------------------------------------------------------------------
echo.



2. Create this .sh script in /usr/local/bin/dos2cygwin.sh :

#!/bin/bash
echo
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "Welcome to the Cygwin BASH script dos2cygwin.sh, called by dos2cygwin.cmd"
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo
sleep 5
echo "Here is a calendar for the current month"
cal
echo
sleep 7
echo "Let's see if port 445 is open on this Windows machine"
netstat -an | grep -w 445
sleep 5
echo
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "Goodbye from the Cygwin BASH script dos2cygwin.sh, called by
dos2cygwin.cmd"
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo
sleep 2


3. At the Cygwin BASH prompt, set execute permission for dos2cygwin.sh

chmod +x /usr/local/bin/dos2cygwin.sh


4. Right click on the Windows desktop and create a new shortcut.

5. In the Type the location of the item field in the new shortcut,
paste in the following text, (adjusting for Windows 7's location of
CMD.EXE:)

C:\WINDOWS\system32\cmd.exe /c C:\cygwin\usr\local\bin\dos2cygwin.cmd

6. Click Next, then click Finish.

7. On the desktop, find the shortcut just made, double click, and the
script should run.

8. You can run this "manually" by opening a CMD.EXE window, and typing
the command line at the prompt:

C:\Users\Keith> C:\cygwin\usr\local\bin\dos2cygwin.cmd

9. DONE.


Let me know if this works out, have fun.

=====Keith

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]