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: Some Batch-Scripting-Problems under Windows


Daniel Spannbauer wrote:
> 
> Hello,
> 
> we've build a Program for Cygwin to load some Firmware in some 
> Hardware
> which is produced by us.
> The Firmwware is called file.tld. At the moment the USer has to open
> Cygwin, jumpd to the Path of the file.tld (for example: C:\Dokumente 
> und
> Einstellungen\test\Eigene Dateien\tload) an run the program by "tload
>  -l
> /dev/ttyS0 file.tld".
> 
> This is very uncomfortable.
> Now I try to write a simple Batch-Script to do this automaticly, so 
> you
> have just to douible-klick  on file.tld an the  Firmware is loaded 
> over
> a predefined serial Line.
> 
> The batch-Script looks as follows:
> 
> LINE=/dev/ttyS0
> c:\Programme\cygwin\bin\bash -c "/bin/tload.exe -l %LINE% %1%"
> 
> But this won't work couse "%1%" is still "C:\Dokumente und
> Einstellungen\test\Eigene Dateien\tload\file.tld" which isn't a 
> cygwin-Path.
> So I cahnged the script as follows:
> 
> LINE=/dev/ttyS0
> c:\Programme\cygwin\bin\bash -c "/bin/tload.exe -l %LINE% 
> '/bin/cygpath
> -a -i %1%' "
> But this also don't work. couse "%1% has Double-Quots (") at first and
> last place.
> 
> I think it is just a quoting-Problem.
> 
> Any Ideas out there?
> 
> Regards
> 
> Daniel

Daniel:

Any time U run Cygwin programs, U need to make sure that the PATH var-
iable includes Cygwin directories.  The best way to do that is to
launch Cygwin executables from another Cygwin executable that has set
up the PATH so that U don't have to.  Take a look at /cygwin.bat,
which is often the first Cygwin program on a system to be invoked, for
an example.  It invokes bash.exe, which sources /etc/profile, which is
where /usr/local/bin/, /usr/bin/, et.al., are prepended to the Windows
PATH.  All Cygwin executables launched from this login shell will in-
herit any exported ENVIRONMENT variables, include $PATH and $LINE
(%LINE% from Windows).

Were I in your position, I would make a copy of /cygwin.bat that looks
something like this:
<code>
@echo off

C:
chdir c:\path\to\your\cygwin\bin

bash -c "cd /cygdrive/c/Dokumente\ und\ Einstellungen/test/Eigene\
Dateien/tload;tload -l %LINE% %1%"
</code>

The above .BAT file is a good starting point.
 
--------------------------------------------------------

Goss ... Innovation for Business

NOTICE: This e-mail and any attachment(s) may contain confidential and proprietary information of Goss International Corporation and/or its subsidiaries and may be legally privileged. This e-mail is intended solely for the addressee. If you are not the addressee, dissemination, copying or other use of this e-mail or any of its content is strictly prohibited and may be unlawful. If you are not the intended recipient please inform the sender immediately and destroy the e-mail and any copies. All liability for viruses is excluded to the fullest extent permitted by law. Any views expressed in this message are those of the individual sender. No contract may be construed by this e-mail.


--
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]