Hi I want to map a network drive on Windows platform and i am running my script on Unix machine;
What are the possibilities by which i can map network drive in perl

Please reply

thanks in Advance,
aNa

Wait What?

You're running a script on *nix, and want that script to map a drive on a windows machine?????

no i am using script on windows platform only but executing it using cygwin; find below code
#/usr/bin/perl

$map_drive = '/cygdrive/c/windows/system32/net use x: \\share1\share2';
print "\n$map_drive\n ";

system ("$map_drive");

i get below error
/cygdrive/c/windows/system32/net use x: \share1\share2
System error 67 has occurred.

The network name cannot be found.


Please reply

ah, you are missing a slash of some kind it seems... you are escaping the first backslash with the second. You probably need to add something like this:

$map_drive = '/cygdrive/c/windows/system32/net use x: \\\\share1\\share2';

I dunno if there is a cleaner way to say "hey, don't escape this stuff", but this should work.

thanks for the reply let me try and get back to you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.