This is the mail archive of the cygwin@cygwin.com 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: Better solution for calling 'net use' from Cygwin Perl?


On Wed, 15 May 2002 16:45:06 -0400 Scott Prive <Scott.Prive@storigen.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@justpickone.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/


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