a long time ago, I had to rename a lot of drive mappings on a lot of PCs - this is how I did it, knowing full well there are better ways to do it.
########################
### make_map_bat.pl ###
######################
print " Drive Share Mapper\n";
print "--------------------\n";
print "If you just want to create a new share - just press\n";
print "enter for the first two questions\n\n";
print "What server is your share currently mapped to: ";
$current_server=<stdin>;
chomp ($current_server);
print "What is the name of the current share: ";
$current_share=<stdin>;
chomp ($current_share);
unless ( `net view $current_server|grep $current_share`) { print "\\\\
+$current_server\\\\$current_share does not exist!\n\n" }
print "What drive letter is this share currently using: ";
$drive_letter=<stdin>;
chomp ($drive_letter);
print "What server is the new share on: ";
$new_server=<stdin>;
chomp ($new_server);
print "What is the name of the new share: ";
$new_share=<stdin>;
chomp ($new_share);
unless ( `net view $new_server|grep $new_share`) { print "\\\\$new_ser
+ver\\\\$new_share does not exist!\n\n" }
open (BATCHFILE, ">c:\\$new_share.bat") || die "Cannot open file for w
+riting: $!\n";
unless ( $current_server eq "" ) {
print BATCHFILE "REM *** DELETE OLD SHARE ***\n";
print BATCHFILE "net use $drive_letter: \/delete\n";
}
print BATCHFILE "REM *** ADD A NEW PERSISTENT SHARE ***\n";
print BATCHFILE "net use $drive_letter: \\\\$new_server\\$new_share \/
+persistent:yes\n";
close BATCHFILE;
print "\n\n";
print "A file named $new_share.bat has been placed in C:\\\n";