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: Trick cmd.exe of Windows XP to run cygwin Batch Script.


On Sun, 4 Jan 2009 12:07:31 +0100, Spiro Trikaliotis
<an-cygwin@spiro.trikaliotis.net> wrote:
>d:\> bash -c ./myscript

I've tested the above code and work it out like this:

set cygwin_bin=C:\cygwin\bin
%cygwin_bin%\bash -l %~dp0myscript > myresult

In the above example by me,  we need to pay attention to the following
matters:

1- %~dp0myscript mean that the file myscript is located at the same
directory as the bat file, i.e, the batch file which include the above
patch codes I posted here.  This batch file will invoke the bash
script file myscript.

2- the -c parameter used by you shouldn't be used here, if I used it,
I will meet the errors like this:

... command not found

3- The --login or -l must be used here, otherewise the following error
will be occur like this:

myscript: line 1: awk : command not found

4- The path name conventions in the invoking of this batch file, the
dos rule, i.e., _\_,  should be used instead of the bash convention,
i.e., _/_, as the delimitor of path.

5- In your case,

>d:\> bash -c ./myscript

actully, in the usage, the file myscript must ba put into the bash's
directory, i.e., C:\cygwin\bin.  This is not a convenient solution.

Regards,

-- 
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.


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


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