Replace files that are currently in use by the OS, requires a reboot.
Inuse is deprecated, and is not guaranteed to be supported in future releases of Windows.
Syntax INUSE source destination [/y] Key source The new/replacement file. destination The existing file to be replaced. /y Suppress the confirmation prompt. /? help
Source and destination must include the complete physical or UNC pathname.
The file will be replaced when the machine is rebooted.
The 'locked file can be either the source or destination file.
Example
inuse.exe \\server64\install\shiny.dll c:\program files\ss64\shiny.dll /y
Replacing in-use files, can also be done manually with the REGEDIT registry editor:
Open HKLM\SYSTEM\CurrentControlSet\Control\Session Manager
Double click on
PendingFileRenameOperations
(if it does not exist - create of type REG_MULTI_SZ )
On the first line is the destination file prefixed with \??\
e.g.
\??\d:\backup\trouble.sys
On the second line is the source file to be moved prefixed with !\??\
e.g.
!\??\c:\windows\system32\drivers\trouble.sys
So the complete Multi-String Data would appear like:
\??\d:\backup\trouble.sys
!\??\c:\windows\system32\drivers\trouble.sys
Reboot the machine and the file will be moved and the PendingFileRenameOperations registry key will be deleted.
“Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction” - Albert Einstein
Related:
Q228930 - How to replace currently locked files with Inuse.exe
Powershell: Move-Item - Move an item from one location to another (move/mv/mi)
Equivalent bash command (Linux): mv - Move or rename files or directories.