Create a virtual drive (Perl)
This code can be found in
Chapter 7 of Windows XP Cookbook
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the Perl code from this site.
# From the book, "Windows XP Cookbook"
# ISBN: 0596007256
# ------ SCRIPT CONFIGURATION ------
use Win32::OLE;
$strDrive = '<Drive>';
# e.g. e:
$strPath = '<Path>';
# e.g. c:\scripts
# This assumes subst is in your PATH, if not, fully qualify
# the path to the command here:
$strCommand = 'subst ' . $strDrive . ' ' . $strPath;
# ------ END CONFIGURATION ---------
$objWshShell = Win32::OLE->new('WScript.Shell');
$intRC = $objWshShell->Run($strCommand, 0, 1);
if ($intRC != 0) {
print 'Error returned from running the command: ' . $intRC, "\n";
print "Command attempted: $strCommand\n";
}
else {
print "Command executed successfully.\n";
}
|
This code has been viewed 961 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|