What is the command line needed for?
USB Safely Remove's command line allows to operate devices from the command line console. It is a full-fledged console application letting you perform the most of operations that the GUI version does: to see device list, to stop a device, to return it back, find out what processes are locking a device.
It is useful for using in batch scripts that interact with hot-plug devices. Here are some examples of usage:
Command line syntaxThe common rules of the syntax are:
usr <command_name> [command_parameters], where
command_name - one of the listed below command names
command_parameters - parameter set of the command, e.g. for "stop" command it can be either a device name or a drive letter
Errorlevels returned by the command line0 - The operation is successfully completed
1 - The device with the given parameters has not been found
2 - The device cannot be stopped or returned back. This error might happen when the device is locked by another program (in case of "return" command, this code means that the device's neighbour at USB hub might be locked by some processes). Also it may happen if the device is not physically hot-swappable
3 - Incorrect command syntax
4 - The command is unknown
5 - Cannot find processes that are locking: the device (on device stopping) or its neighbours at USB hub (on device returning). It may happen if the device either now is free to eject, or it is locked by a process run with more privileges (e.g. under System account)
6 - A technical error occured while searching for device locking processes
7 - the command is not supported by a specific device
Detailed command descriptions
Intended to device safe removal.
usr stop <command_parameters>Possible <command_parameters>:
Forcibly stops the device. If the device cannot be stopped it closes all files and programs preventing this action and try to to stop the device again
Attention! This command closes all opened files from the device if they exist. So use this command if you are sure that there are no important data to save!
usr forcedstop <command_parameters>Possible <command_parameters>:
Intended to return stopped but not yet unplugged device back.
usr return <command_parameters>Possible <command_parameters>:
Forcibly returns just stopped device back. If the device cannot be returned it closes all files and programs preventing this action and try to return the device again. Works only for USB 1.x/2.0 ports.
Attention! In order to return the device back the command reboots the USB hub wh ere the device is connected to. Therefore this operation will also cause stoppin g and reactivation of all other neighbor devices connected to the same hub, and files opened by some processes from these neighbor devices will be closed. So us e this command if you are sure that there are no important data to save!
usr forcedreturn <command_parameters>Possible <command_parameters>:
Displays the list of hot-plug devices
usr list [command_parameters]Possible "command_parameters":
When there are no options defined the command displays all hot-plug devices (the same as with option "-a")Examples:
Displays the list of processes that prevent a device from being stopped or returned back
If the device is stopped but not yet unplugged the command will return the list of processes locking neighbour devices at USB hub. On why it does this, read more here.Syntax:
usr wholocks <command_parameters>:Possible <command_parameters>: