Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 Subject: Re: Better solution for calling 'net use' from Cygwin Perl? To: Scott Prive , "CygWin Users' List" MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-Disposition: INLINE References: <7BFCE5F1EF28D64198522688F5449D5A4CEC1F AT xchangeserver2 DOT storigen DOT com> In-Reply-To: <7BFCE5F1EF28D64198522688F5449D5A4CEC1F@xchangeserver2.storigen.com> Reply-To: Michael A Chase Message-Id: On Wed, 15 May 2002 16:45:06 -0400 Scott Prive 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/