This can help you avoid tracking down users or having to install unnecessary utilities on your system.

Setup and Usage

The script can be placed anywhere on your system.

The script will continuously make a run at delete the old file while waiting several seconds in between tries.

Easily Replace a Locked File Once it Becomes Unlocked

SETLOCAL EnableExtensions

REM Validation.

REM Log off prompt.

If you do not want to see this, you’re able to delete these lines.

image

ECHO Automatically log off once the replace process has completed?

ECHO Enter ‘Y’ to automatically log off or enter anything else to not.

ECHO The Old File is still locked.

image

Waiting a few moments to retry.

ECHO Stopping without doing anything.

Press any key to close.

image

ECHO You will be logged off shortly.

SHUTDOWN /L

ENDLOCAL

Download ReplaceFile Script from SysadminGeek.com