Perl on Windows

Perl on Windows

am 03.12.2005 22:03:31 von nmventure

newby wants to know How do you map a network drive, or other shared device,
with perl. If there is a better news group for Perl on Windows questions,
please point the way....Thanks in advance, Mike.
--------------------------------
Using Active Perl on Win 2000

Re: Perl on Windows

am 03.12.2005 22:15:45 von Sherm Pendley

"nmventure" writes:

> newby wants to know How do you map a network drive, or other shared device,
> with perl. If there is a better news group for Perl on Windows questions,
> please point the way....Thanks in advance, Mike.

Dunno if there's something in the Win32:: module or not. But, isn't there a
simple command you can use to do that in a command shell? If so, you could
just run that with system().

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

Re: Perl on Windows

am 04.12.2005 01:16:01 von Matt Garrish

"Sherm Pendley" wrote in message
news:m23bl9dgqm.fsf@Sherm-Pendleys-Computer.local...
> "nmventure" writes:
>
>> newby wants to know How do you map a network drive, or other shared
>> device,
>> with perl. If there is a better news group for Perl on Windows
>> questions,
>> please point the way....Thanks in advance, Mike.
>
> Dunno if there's something in the Win32:: module or not. But, isn't there
> a
> simple command you can use to do that in a command shell? If so, you could
> just run that with system().
>

NET USE
[devicename | *] [\\computername\sharename[\volume] [password | *]]
[/USER:[domainname\]username]
[/USER:[dotted domain name\]username]
[/USER:[username@dotted domain name]
[/SMARTCARD]
[/SAVECRED]
[[/DELETE] | [/PERSISTENT:{YES | NO}]]

Matt

Re: Perl on Windows

am 04.12.2005 19:07:01 von nmventure

Thanks Matt., but..is that suppose to work with perl? That works from a
Windows
command line but I would like to know how to do it in perl, if it can be
done....

Mike

"Matt Garrish" wrote in message
news:3zqkf.6673$Et5.477480@news20.bellglobal.com...
>
> "Sherm Pendley" wrote in message
> news:m23bl9dgqm.fsf@Sherm-Pendleys-Computer.local...
> > "nmventure" writes:
> >
> >> newby wants to know How do you map a network drive, or other shared
> >> device,
> >> with perl. If there is a better news group for Perl on Windows
> >> questions,
> >> please point the way....Thanks in advance, Mike.
> >
> > Dunno if there's something in the Win32:: module or not. But, isn't
there
> > a
> > simple command you can use to do that in a command shell? If so, you
could
> > just run that with system().
> >
>
> NET USE
> [devicename | *] [\\computername\sharename[\volume] [password | *]]
> [/USER:[domainname\]username]
> [/USER:[dotted domain name\]username]
> [/USER:[username@dotted domain name]
> [/SMARTCARD]
> [/SAVECRED]
> [[/DELETE] | [/PERSISTENT:{YES | NO}]]
>
> Matt
>
>

Re: Perl on Windows

am 04.12.2005 20:48:35 von Sherm Pendley

"nmventure" writes:

> "Matt Garrish" wrote in message
> news:3zqkf.6673$Et5.477480@news20.bellglobal.com...
>>
>> "Sherm Pendley" wrote in message
>> news:m23bl9dgqm.fsf@Sherm-Pendleys-Computer.local...
>> >
>> > Dunno if there's something in the Win32:: module or not. But, isn't
>> > there a simple command you can use to do that in a command shell? If
>> > so, you could just run that with system().
>>
>> NET USE
>> [devicename | *] [\\computername\sharename[\volume] [password | *]]
>> [/USER:[domainname\]username]
>> [/USER:[dotted domain name\]username]
>> [/USER:[username@dotted domain name]
>> [/SMARTCARD]
>> [/SAVECRED]
>> [[/DELETE] | [/PERSISTENT:{YES | NO}]]
>>
>> Matt
>
> Thanks Matt., but..is that suppose to work with perl? That works from a
> Windows command line but I would like to know how to do it in perl, if it
> can be done....

Like I said the first time - use system() to run the command. And please don't
post upside-down - replies belong after the original, not before.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

Re: Perl on Windows

am 04.12.2005 22:36:17 von Matt Garrish

"nmventure" wrote in message
news:mlGkf.10$Ug.100451@news.sisna.com...

[TOFU corrected]

>
> "Matt Garrish" wrote in message
> news:3zqkf.6673$Et5.477480@news20.bellglobal.com...
>>
>> "Sherm Pendley" wrote in message
>> news:m23bl9dgqm.fsf@Sherm-Pendleys-Computer.local...
>> > "nmventure" writes:
>> >
>> >> newby wants to know How do you map a network drive, or other shared
>> >> device,
>> >> with perl. If there is a better news group for Perl on Windows
>> >> questions,
>> >> please point the way....Thanks in advance, Mike.
>> >
>> > Dunno if there's something in the Win32:: module or not. But, isn't
> there
>> > a
>> > simple command you can use to do that in a command shell? If so, you
> could
>> > just run that with system().
>> >
>>
>> NET USE
>> [devicename | *] [\\computername\sharename[\volume] [password | *]]
>> [/USER:[domainname\]username]
>> [/USER:[dotted domain name\]username]
>> [/USER:[username@dotted domain name]
>> [/SMARTCARD]
>> [/SAVECRED]
>> [[/DELETE] | [/PERSISTENT:{YES | NO}]]
>>
> Thanks Matt., but..is that suppose to work with perl? That works from a
> Windows
> command line but I would like to know how to do it in perl, if it can be
> done....
>

I'm not aware of any modules explicitly written for that purpose, and there
is no native perl way to perform an O/S specific operation like this (one
way or another you're going to have to interface with O/S to map drives). As
sherm has already mentioned, the easiest solution is to just make a system
call.

Matt

Re: Perl on Windows

am 04.12.2005 23:17:19 von nmventure

"Matt Garrish" wrote in message
news:hjJkf.415$kt5.72359@news20.bellglobal.com...
>
> "nmventure" wrote in message
> news:mlGkf.10$Ug.100451@news.sisna.com...
>
> [TOFU corrected]
>
> >
> > "Matt Garrish" wrote in message
> > news:3zqkf.6673$Et5.477480@news20.bellglobal.com...
> >>
> >> "Sherm Pendley" wrote in message
> >> news:m23bl9dgqm.fsf@Sherm-Pendleys-Computer.local...
> >> > "nmventure" writes:
> >> >
> >> >> newby wants to know How do you map a network drive, or other shared
> >> >> device,
> >> >> with perl. If there is a better news group for Perl on Windows
> >> >> questions,
> >> >> please point the way....Thanks in advance, Mike.
> >> >
> >> > Dunno if there's something in the Win32:: module or not. But, isn't
> > there
> >> > a
> >> > simple command you can use to do that in a command shell? If so, you
> > could
> >> > just run that with system().
> >> >
> >>
> >> NET USE
> >> [devicename | *] [\\computername\sharename[\volume] [password | *]]
> >> [/USER:[domainname\]username]
> >> [/USER:[dotted domain name\]username]
> >> [/USER:[username@dotted domain name]
> >> [/SMARTCARD]
> >> [/SAVECRED]
> >> [[/DELETE] | [/PERSISTENT:{YES | NO}]]
> >>
> > Thanks Matt., but..is that suppose to work with perl? That works from a
> > Windows
> > command line but I would like to know how to do it in perl, if it can be
> > done....
> >
>
> I'm not aware of any modules explicitly written for that purpose, and
there
> is no native perl way to perform an O/S specific operation like this (one
> way or another you're going to have to interface with O/S to map drives).
As
> sherm has already mentioned, the easiest solution is to just make a system
> call.
>
> Matt
>
>
Ok, I'll give that a try, thanks.....
Mike

Re: Perl on Windows

am 07.12.2005 04:59:07 von John Smith

nmventure wrote:
> newby wants to know How do you map a network drive, or other shared device,
> with perl. If there is a better news group for Perl on Windows questions,
> please point the way....Thanks in advance, Mike.
> --------------------------------
> Using Active Perl on Win 2000
>
>


You can also map the drive via Win32::OLE, as shown below:
###############################
#!c:\perl\bin\perl.exe
use Win32::OLE;

my $objnet=Win32::OLE->CreateObject("Wscript.Network");
$objnet->MapNetworkDrive("G:","\\\\Servername\\Sharename\\ot her dir");
###########################

Now, that wasn't so hard, right?

Basically, Win32::OLE lets you leverage all the scripting examples
available in Microsoft's Scripting Repository (and more).

For just Perl scripts:
http://www.microsoft.com/technet/scriptcenter/scripts/perl/d efault.mspx

For all Script Center scripts (most are in VBS, but can be easily
translated):
http://www.microsoft.com/technet/scriptcenter/scripts/defaul t.mspx



Hope this helps,
Thoth