INUSE - CMD


Overview

INUSE is a command-line utility in Windows that allows the replacement of files that are locked by the system or by any application. It is usually used by system administrators and IT professionals to update essential system files or DLLs that cannot be updated while the operating system is running because they are currently in use.

Syntax

The basic syntax for using the INUSE command is as follows:

INUSE source destination [/Y]
  • source: Specifies the path of the new file.
  • destination: Specifies the path where the file in use will be replaced.

The square brackets ([]) indicate that the argument inside them is optional.

Options/Flags

  • /Y: Suppresses prompting to confirm that you want to overwrite the file. Without this flag, you would be prompted for confirmation before any file is overwritten.

Examples

  1. Basic File Replacement:
    Replace a system file without being prompted:

    INUSE C:\updates\newfile.dll C:\Windows\System32\oldfile.dll /Y
    

    This command will replace oldfile.dll in the System32 folder with newfile.dll located in the C:\updates folder without prompting for confirmation due to the /Y option.

  2. Without Overwrite Confirmation:
    When the /Y flag is not used:

    INUSE C:\updates\newfile.dll C:\Windows\System32\oldfile.dll
    

    This commands performs the replacement but will prompt the user to confirm the overwrite of oldfile.dll.

Common Issues

  • File Path Errors: Incorrect file paths can lead the command to fail. Ensure paths are correct and the file exists at the specified location.
  • Access Denied: Running INUSE without sufficient privileges (not running as administrator) can lead to access denials. Ensure you have the required permissions to replace a file in use.

Integration

INUSE can be part of larger scripts or maintenance routines. For example, it can be combined with scheduled tasks to update files during off-hours. Here’s how to use INUSE in a simple batch script to auto-update a list of files at system restart:

@echo off
INUSE C:\updates\newfile1.dll C:\Windows\System32\oldfile1.dll /Y
INUSE C:\updates\newfile2.dll C:\Windows\System32\oldfile2.dll /Y
shutdown -r -t 00

This script replaces two old DLLs, and then reboots the system immediately to finalize the in-use replacement.

  • MOVE: Move files from one folder to another. Useful in scenarios where file replacement is not needed, just relocation.
  • COPY: Copy files from one location to another. Works well together with INUSE when backups of original files are needed before replacement.

For more detailed information, consult the Windows Command Line documentation on the official Microsoft website or the built-in help by running INUSE /? in the command prompt.