delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/05/15/17:52:10

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Wed, 15 May 2002 14:51:25 -0700 (Pacific Daylight Time)
From: Michael A Chase <mchase AT ix DOT netcom DOT com>
Subject: Re: Better solution for calling 'net use' from Cygwin Perl?
To: Scott Prive <Scott DOT Prive AT storigen DOT com>,
"CygWin Users' List" <cygwin AT cygwin DOT com>
MIME-Version: 1.0
References: <7BFCE5F1EF28D64198522688F5449D5A4CEC1F AT xchangeserver2 DOT storigen DOT com>
In-Reply-To: <7BFCE5F1EF28D64198522688F5449D5A4CEC1F@xchangeserver2.storigen.com>
Reply-To: Michael A Chase <mchase AT ix DOT netcom DOT com>
Message-Id: <E1786gD-00013F-00@hall.mail.mindspring.net>

On Wed, 15 May 2002 16:45:06 -0400 Scott Prive <Scott DOT Prive AT storigen DOT com> wrote:

> I had a bad (meaning 'foolish' :-) feeling we overlooked the
> double-escaping just as I opened your email. 

I normally build all file or directory strings using '/' and then convert
them before passing them to any programs that insist on '\'s.  That way I
don't have to worry about too few or too many '\' escapes.  Note that this
won't convert POSIX filenames to Win32, I use cygpath.exe for that.

You might also want to keep any shells from getting involved with your
arguments; they sometimes treat '\' badly:

my $share =  "//storigen1u21/sfstest";
$share =~ s,\\,/,g;
system( "c:/WINDOWS/system32/net.exe", "use", "t:", $share );

> -----Original Message-----
> From: David T-G [mailto:davidtg-cygwin AT justpickone DOT org]
> Sent: Wednesday, May 15, 2002 4:15 PM
> To: CygWin Users' List
> Subject: Re: Better solution for calling 'net use' from Cygwin Perl?
> 
> . . .
> % I had a .sh script that called Microsoft's "net use" command to mount
> drives under Win2k, and this worked:
> % net use 't:' '\\myserver\share'
> 
> . . .
> % However I needed to do this in Cygwin Perl so I could leverage an
> existing set of Perl libraries I have.
> % 
> % For the life of me I could correctly execute the "net use" command
> from Perl, because the characters would get escaped or not interpreted
> correctly.

-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019