Drive Tools for Windows
 
  German version of this page
 
  Licence
 
All tools on this page are Freeware.

Allowed:
- usage in any environment, including commercial
- include in software products, including commercial
- include on CD/DVD of computer magazines

Not allowed:
- modify any of the files

 

  RemoveDrive V1.9 - Safe removal of drives
 
RemoveDrive prepares drives for "Safe Removal" by commandline. It works with drives only but not for other device types.
RemoveDrive DriveSpec: [-l][-h][-b][-i][-s][-w:nnnn]

DriveSpec  is the drive to remove, e.g. U: or an NTFS mountpoint as "C:\CardReader\Multi Reader SD"
           or . for the current drive
           or \ for the drive of the RemoveDrive.exe
           or a volume name like \\?\Volume{433619ed-c6ea-11d9-a3b2-806d6172696f}
[-L]       loop until success
[-h]       show open handles (admin rights required, exprimental, may freeze!)
[-w:nnnn]  wait nnnn milliseconds before close
[-s]       self delete removedrive.exe
[-b]       let Windows show the "Safe To Remove Hardware" balloon tip
[-i]       stop Windows indexing service (CiSvc) for a moment if required (admins)
[-d]       show debug information

or

RemoveDrive "AnyIdString"

RemoveDrive can be used with all types of drives. Started with -L it tries to remove the drive in an endless loop until success or until canceled.
As result it shows 'success' in green or 'failed' in red.
Sample:

removedrive u: -L
would try to prepare drive U: for safe removal in an endless loop until success.

For drives mounted into NTFS folders the full path of the folder can be used:

removedrive "E:\_CardReader\USB20 CF" -L
Used with multislot-cardreaders it would remove the whole reader, regardless of the given slot. For removing a card only, use my EjectMedia tool, see below.

Instead the drive letter one of the drive's device ID strings can be used. The friendly name can be used as "Corsair Flash Voyager" or the hardware ID of the drive, like USB\VID_1234&PID_5678...
Wildcards can be used here. E.g. RemoveDrive *Flash* to remove the first drive with 'Flash' in its device name.

RemoveDrive can be started from the drive to remove. Because a running EXE on a drive prevents a drive being prepared for safe removal it creates a temporary, self deleing copy and starts it with the same parameters. To be drive letter independent, use . instead a drive letter. The current drive is removed then. To remove the drive of the RemoveDrive.exe use \ as drive.

If the removal fails then someone still accesses the drive. This can be something banal like an open Word document or an mounted TrueCrypt container or some kind of monitoring tool like a virus scanner. A network share on the drive that has been used makes the removal fail too...
By means of SysInternals ProcessExplorer you might be able to discover which program holds an open handle to the drive. After starting it go to 'Find' -> 'Find Handle or DLL', enter the drive letter like X:\ or a part of the DOS device name like 'Harddisk3' and search. You get the 'DOS device name' by means of my ListUsbDrives or ListDosDevices.

Download: removedrive.zip

Last update: 2 August 2009

For programmers I've made a demo project which shows the essentials: How to prepare an USB drive for safe removal

An alternative to the Windows tray icon is "HotSwap":
http://mysite.verizon.net/kaakoon/hotswap/index_enu.htm

 

  EjectMedia - eject a media from a drive
 
It ejects a media from a drive rather that removing the whole device. Ejecting the media only is especially suitable for internal cardreaders.
On CD/DVD and ZIP drives the media is physically ejected while on flash cardreaders the media is ejected logically only. It cannot being accessed before it's removed and inserted again.

Under XP this is not allowed for restricted users but this can be enabled by a policy.

EjectMedia DriveSpec [-L][-d][-f][-h][-w:nnnn]


DriveSpec  is the drive whose media to eject, e.g. U: or an NTFS mountpoint as "C:\CardReader\Multi Reader SD"
           or . for the current drive
           or \ for the drive of the EjectMedia.exe
           or a volume name like \\?\Volume{433619ed-c6ea-11d9-a3b2-806d6172696f}
[-L]       loop until success
[-d]       dismount only (do not eject)
[-f]       force dismount or eject
[-h]       show open handles (admin rights required, exprimental, may freeze!)
[-w:nnnn]  wait nnnn milliseconds before close
As RemoveDrive, EjectMedia can be started from the drive to remove.

Download: ejectmedia.zip

Last update: 2 August 2009

 

  ReMount - change drive letters
 
Using ReMount you can quickly change a drive letter without clicking thru the Windows disk management. E.g. to change drive F: to U:
remount f: u:
If both letters are in use and shall be swapped then use parameter -s
remount f: u: -s
For nonsense operations, as remonting the Windows system drive or mounting a local drive to a letter used by a network drive, use parameter -f (force).
remount c: x: -f
Instead of drive letters you can use NTFS mount points too.
Admin privileges are required.

Download: remount.zip

Last update: 23 July 2009

 

  DriveCleanup - remove nonpresent drives from the registry
 
DriveCleanup removes all currently non present "Storage Volumes", "Disk", "CDROM", "Floppy" USB drives and their USB devices from the device tree. Furthermore it removes orphaned registry items related to these device types.
Started with parameter -T (like test) it shows which devices it would remove. Started without a parameter, it does its job without further inquiry.
To remove certain types of devices there are the parameters -U -D -C -F -V and -R.

Under x64 editions of Windows only the included x64 works correctly.

Admin privileges required.

Download V0.7:
drivecleanup.zip

Download V0.4 (without registry cleaning):
drivecleanup04.zip

 

  ListDosDevices
 
Drive letters are references to kernel objects thru 'symbolic links'. For historical reasons they are sometimes called 'DOS device names'.
ListDosDevices shows which 'symbolic link' is behind each drive letter.
Sample:
A:  REMOVABLE  \Device\Floppy0
B:  ----
C:  FIXED      \Device\HarddiskVolume1
D:  FIXED      \Device\HarddiskVolume2
E:  CDROM      \Device\CdRom0
F:  CDROM      \Device\CdRom1
G:  ----
H:  ----
I:  ----
J:  ----
K:  ----
L:  ----
M:  ----
N:  ----
O:  ----
P:  REMOTE     \Device\LanmanRedirector\;P:0000000000013548\server01\public
Q:  ----
R:  ----
S:  FIXED      \??\C:\Dokumente und Einstellungen\Uwe\Anwendungsdaten
T:  ----
U:  REMOVABLE  \Device\Harddisk5\DP(1)0-0+19
V:  ----
W:  ----
X:  ----
Y:  FIXED      \Device\TrueCryptVolumeY
Z:  ----
Here are
A: Floppy
C: + D: partitions of a fixed drive
E: + F: CD or DVD drives
P: Network drive
S: Subst drive
U: USB flash drive (Win2000, XP, 2003; Under Vista the 'DOS device name' looks like a partition)
Y: TrueCrypt drive

Download: listdosdevices.zip

 

  DeleteDosDevice
 
When a software crashes which had created virtual drives under a drive letter, then it lets a dead drive letter behind.
Started again the software in question may be able to fix this but somtimes it just sees a drive letter in use.
In such cases you can remove the dead drive letter by means of DeleteDosDevice.
Sample for removing X:
deletedosdevice x:

Download: deletedosdevice.zip

Last update: 26 April 2009

 

  RescanDevices
 
When an IDE or SATA drive has been prepared for safe removal it can be braught back by a scan for new hardware.
That's what this tool initiates.

It is a non interactive, invisible Windows application. It does the same as Microsoft's tool DEVCON when called with parameter 'rescan', but no console window pops up.

Download: rescandevices.zip

 

  AutoRun Settings V1.2
 
AutoRunSettings gives easy access to the basic Windows AutoRun settings.

AutoRun can be disabled depending on the drive type and depending on the drive letter by Explorer Policies.
These values are
- NoDriveAutoRun
and
- NoDriveTypeAutoRun

under
SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer
See here:
NoDriveAutoRun http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/58886.mspx
By default (the value doesn't exist) AutoRun is enabled for all drive letters.
NoDriveTypeAutoRun
http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/93502.mspx

They are valid under HKEY_LOCAL_MACHINE and under HKEY_CURRENT_USER. If a value exist under HKEY_LOCAL_MACHINE then the same value under HKEY_CURRENT_USER is ignored.
Microsoft TweakUI sets the values under HKEY_CURRENT_USER only and completely ignores HKEY_LOCAL_MACHINE. Furthermore TweakUI cannot make settings for hard drives and it enables AutoRun for network drives by completly ignoring the default values.

These settings have effect only for the moment when a drive is attached. They do not deactivate AutoRun when the drive is opened manually in the Windows Explorer. This is changend with the Microsoft Patch KB950582, availlable since August 2008, see here:
http://support.microsoft.com/kb/953252
Since end of February 2009 it is automatically distrbuted as KB967715...

An alternative is to completely disable the autorun.inf mechanisms as suggested by the US-CERT.

Another setting for CDROM drives is the value "AutoRun" under HKLM\SYSTEM\CurrentControlSet\Services\Cdrom. Despite the name it controls the 'Auto Insert Notification', also called 'Media Change Notification (MCN)'. When deactivated media changes are not detected, therefore AutoRun does not work. But this is a side effect only. This should stay activated. Microsoft says "Do not disable the MCN message unless you have no alternative".

Screenshot:

autorunsettings

Download: autorunsettings.zip

Last update: 5 June 2009

 

  Misc
 
To work effective on the Windows Console I suggest FAR - the File and Archive Manager by RARSoft. It's a Norton Commander clone for the Win32 Console.
And my Console fonts to get an authentic DOS look :-)

 


Counter since Feb. 1998



 

last change: 20 June 2009

Uwe Sieber

Home: http://www.uwe-sieber.de/english.html