Replace a file that is in use (VBScript)

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 VBScript 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
strCmdString = "inuse.exe c:\foo.dll c:\windows\system32\foo.dll"
' ------ END CONFIGURATION ---------
set objWshShell = CreateObject("WScript.Shell")
set objExec = objWshShell.Exec(strCmdString)
do while not objExec.StdErr.AtEndOfStream
 WScript.Echo objExec.StdErr.ReadLine()
loop
do while not objExec.StdOut.AtEndOfStream
 WScript.Echo objExec.StdOut.ReadLine()
loop

This code has been viewed 2440 times.

New from the creators of TechTasks.com: StatSheet.com