Replace a file that is in use (Perl)
This code can be found in
Chapter 8 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
# This code executes the inuse command to replace a file.
# ------ SCRIPT CONFIGURATION ------
# Modify the command string as necessary
use Win32::OLE;
$strCmdString = 'inuse.exe c:\\foo.dll c:\\windows\\system32\\foo.dll';
# ------ END CONFIGURATION ---------
$objWshShell = Win32::OLE->new('WScript.Shell');
$objExec = $objWshShell->Exec($strCmdString);
while (!$objExec->StdErr->AtEndOfStream) {
print $objExec->StdErr->ReadLine(), "\n";
}
while (!$objExec->StdOut->AtEndOfStream) {
print $objExec->StdOut->ReadLine(), "\n";
}
|
This code has been viewed 846 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|