help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: specifying Windows filenames


From: Harald Joerg
Subject: Re: specifying Windows filenames
Date: Tue, 24 Jun 2003 09:07:54 +0200
User-agent: Gnus/5.1001 (Gnus v5.10.1) Emacs/21.2 (cygwin)

"Eli Zaretskii" <address@hidden> writes:

>> Newsgroups: gnu.emacs.help
>> From: Gustaf Erikson <address@hidden>
>> Date: Mon, 23 Jun 2003 16:57:52 +0200
>> 
>> I'm using NTEmacs 20.7 on WindowsXP. I'm trying to call a perl script
>> in the "H:\bin\" directory with shell-command-on-region. Perl is from
>> the Cygwin distribution.
>> 
>> I've tried specifying the command  in different ways: 
>> 
>> "H:/bin/command.pl" throws up the script in Notepad(!) So does
>> "H:\\bin\\command.pl".
>
> I think this fails because Windows doesn't know about the "#!" magic
> on the first line of command.pl.  (On Posix systems, the OS kernel
> notices that magic string and handles the rest of the first line by
> invoking the named interpreter on the script.)
>
> I'd try this:
>
>     M-x shell-command-on-region RET perl H:/bin/command.pl RET
>
> Did that work?

That's the same method I thought about in the first moment, but it
shouldn't work.  Gustaf says his Perl is cygwin's, so you'd have to use
cygwin notation:

     M-x shell-command-on-region RET perl /cygdrive/h/bin/command.pl RET

....and even this works only if cygwin Perl is on your _Windows_ PATH.

Mixing cygwin with "native" Windows ports is always tedious and error
prone.  You always have to consider which system is going to expand
and evaluate path names, though PATH and cygwin mounts help a bit.

However, you can shell-command-on-region a .bat file from NTEmacs, so
perhaps the easiest workaround is to write a small .bat file that sets
up the cygwin environment (which e.g. honors #!) and then fires up the
perl script.
-- 
Cheers,
haj


reply via email to

[Prev in Thread] Current Thread [Next in Thread]