The drive I am trying to accuess is a mapped network drive. This dirve is where I want to move files to and it will not always be connected.
Is there anyway I can use a net "use \\kobgxxxxx\c$ /user blah blah1 " in perl to make sure it is connected before I go using the drive.
I know if I put it in a .bat file I can run this part first then run the perl script. I would rather keep it in perl if there is anyway possible. I did try "system use \\kobgxxxxx\c$ /user blah example" but got a bunch of errors.
I am new to perl so any help would be appricated. Thanks much.
I am on windows 2000 advanced server sp3 with perl 5.
Thanks,
Kevin
> --
> To unsubscribe, e-mail: beginners-...@perl.org
> For additional commands, e-mail: beginne...@perl.org
>
>
You can use either
system('net use \\\\kobgxxxxx\c$ /user blah blah1');
or
system('net', 'use', '\\\\kobgxxxxx\c$', '/user', 'blah', 'blah1');
The second option is safer if any of the parameter come from outside
of your script.
In this case it would be better to use a module to do the work for
you. Eg. Win32::FileOp
use Win32::FileOp qw(Map);
Map '' => '\\\\kobgxxxxx\c$', {
user => 'username',
passwd => 'password'
} or die "Can't connect to the server: $^E";
You may install the module with ppm:
c:\> ppm install http://Jenda.Krynicky.cz/perl/Win32-FileOp.ppd
HTH, Jenda
===== Je...@Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
try:
system 'net use h: \\myserver\myshare';
Notice the single quote character for the parameter to system. If you want
to use the double quote character, you will have to escape your backslashes:
system "net use h: \\\\myserver\\myshare";
Good luck,
Levon Barker
> -----Original Message-----
> From: Holcomb, Kevin [mailto:Kevin....@bankofamerica.com]
> Sent: Monday, April 28, 2003 3:08 PM
> Cc: begi...@perl.org
> Subject: help with net use in perl
> Importance: High
>
>
I ended up doing it like this: system (net, "use", "\\\\kodgxxxxx\\D\$", "user blah", "blah1");
And it reports success but from some reason it does not work at times. So i am not sure whats a wrong and need to look into it deeper.
Also the link you gave me has a bad link for Win32::Adminmisc so I did not not understand it or use it.
One quesiton is how do a set a proirity in Windows 2000 Adv Server for a perl script. I want to set it to low proirity and dont know how. Is this possible? "perl foo.pl proirity low"
Thanks for help everyone,
Kevin
-----Original Message-----
From: Wagner, David --- Senior Programmer Analyst --- WGO
[mailto:David....@freight.fedex.com]
Sent: Monday, April 28, 2003 3:17 PM
To: Holcomb, Kevin
Cc: begi...@perl.org
Subject: RE: help with net use in perl
Holcomb, Kevin wrote:
> Hi all,
> I got a small problem.
>
> The drive I am trying to accuess is a mapped network drive. This
> dirve is where I want to move files to and it will not always be
> connected.
>
> Is there anyway I can use a net "use \\kobgxxxxx\c$ /user blah blah1
> " in perl to make sure it is connected before I go using the drive.
>
> I know if I put it in a .bat file I can run this part first then run
> the perl script. I would rather keep it in perl if there is anyway
> possible. I did try "system use \\kobgxxxxx\c$ /user blah example"
> but got a bunch of errors.
>
> I am new to perl so any help would be appricated. Thanks much.
>
> I am on windows 2000 advanced server sp3 with perl 5.
>
> Thanks,
>
>
> Kevin
I would think you could use Lanman, Win32::Adminmisc or go to David Roth's site roth: http://www.roth.net/perl/packages to get what you need to keep it within Perl.
Wags ;)
**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************