Tools for Windows
 
Home

  German version of this page
 
  Licence
 
All tools on this page work under Windows 2000 and higher. They 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
- offer for download by means of a "downloader" software

I don't ask for donations but some users insist, so:
PayPal

 

  USB Device Tree Viewer
 
Got it's own page: UsbTreeView

Download:
Win32:
https://www.uwe-sieber.de/files/UsbTreeView_Win32.zip
x64:
https://www.uwe-sieber.de/files/UsbTreeView_x64.zip

 

  RestartUsbPort V1.0.3 - Restarts a USB port
 
Usage:
RestartUsbPort [PortId] [-l] [-na] [-w:nnnn]
PortId can be
 a device instance ID (in quotation marks because it contains the & char)
 a driver key name
 a device location info
 a friendly device name (in quotation marks if it contains space or &)
 a port chain in UsbTreeView style
-l      lists USB ports that can be restarted
-na     no about info
-w:nnnn waits nnnn milliseconds on end
Samples:

RestartUsbPort -l

RestartUsbPort "USB\VID_0781&PID_5580\AA010319131128161470"

RestartUsbPort {36fc9e60-c465-11cf-8056-444553540000}\0007

RestartUsbPort Port_#0002.Hub_#0008

RestartUsbPort "Sandisk Extreme"

RestartUsbPort 1-4-2

RestartUsbPort 1-4-2 -w:1000
If the & char is used in a parameter then, if started from a command-prompt or a BAT/CMD file, the whole parameter must be enclosed by quotation marks. Otherwise the command processor interprets the & char as separator for two separate commands.

Admin rights are required under Win 8 and 10 (or an active USBDLM command interface).

Returns Errorlevels:

0 - successfully restarted the USB port
1 - no parameters
2 - invalid parameters
3 - given ID not found or no device is attached to the port
4 - restart tried but failed

Background information

This tool calls IOCTL_USB_HUB_CYCLE_PORT which, Microsoft says, power-cycles the USB port and thus initiates a re-enumeration of the attached device.
If there really is a power-cycle performed then it must be very short...
The function is available under XP but usually only for hubs which run with the Microsoft standard driver. 3rd party drivers usually return ERROR_UNKNOWN_FUNCTION.
Under Vista and Windows 7 it is no more supported by the Windows standard drivers, it always fails with ERROR_NOT_SUPPORTED.
Since Windows 8 it works again but in contrast to XP admin privileges are required. Without admin privileges it fails as under Vista and Win7 with ERROR_NOT_SUPPORTED or since Win10 version 1903 with ERROR_GEN_FAILURE, which both are quite missleading here since it's a privilege issue.

Download: RestartUsbPort.zip

Last update: 03 Oct 2021

 

  Device Cleanup Tool V1.1.3 - removes non-present devices from the Windows device management
 
Each once attached device leaves an entry in the Windows device management. By means of the Windows device manager you can delete one by one only. With this tool you can delete multiple or all non-present devices.

The 'last used' time comes from the write time of the device's registry key under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum, on some Windows this seems to be set on boot or any other time.

Non-PnP devices and 'soft' devices are not listed by default, this can be changed in the Options menu.

Screenshot:

devicecleanup

Download: DeviceCleanup.zip

Last update: 03 Oct 2021

 

  Device Cleanup Cmd V1.1.3 - removes non-present devices from the Windows device management
 
This is the command line version of DeviceCleanup, see above.
DeviceCleanup V1.1.3
Uninstalls non-present devices
Freeware by Uwe Sieber - www.uwe-sieber.de

Usage:
DeviceCleanupCmd pattern1 [pattern2] [patternN] [-e:excludepattern1][-t][-s][-m:age][-v][-n]
-e:excludepattern  pattern not to remove
-t  test only
-s  skip creation of a system restore point
-m:age  minimum 'age' (last use of the device must be at least that old)
-v  verbose
-n  no wait when finished

Patterns are device IDs, device classes or friendly names. Wildcards can be used.

Samples:
remove all devices whose device IDs begin with HID\VID_045E
DeviceCleanupCmd HID\VID_045E*

remove all devices whose device IDs contain VID_045E
DeviceCleanupCmd *VID_045E*

remove all bluetooth devices but not COM9 and COM10
DeviceCleanupCmd BTH* -e:"* (COM9)" -e:"* (COM10)"

remove all non present devices whose device class is Media
DeviceCleanupCmd Media

remove all devices not used for 1 year or more (m - month, d - days, i - minutes)
DeviceCleanupCmd * -m:1y

remove all devices
DeviceCleanupCmd *

show which devices would be removed (test mode)
DeviceCleanupCmd -t *
Non-PnP devices and 'soft' devices are not deleted because they are not automatically reinstalled. These are devices whose ID begins with
- HTREE\ROOT\
- ROOT\
- SWD\
- SW\{

If you want to delete them, use a pattern that begins with one of these strings. Or use the GUI version of DeviceCleanup and activate the listing of these devices in the Options menu.

Read about the 'last used' time at DeviceCleanup.

Download: DeviceCleanupCmd.zip

Last update: 03 Oct 2021

 

  RunAsSystem V1.3.5 - starts a process in the SYSTEM context
 
RunAsSystem is helpful when admin privileges are not enough. For instance since Vista there are registry keys whose owner is the administrator but without the privileges to write or change the rights.

RunAsSystem passes the window style and its process priority to the exeucted process. Both can be overruled by commandline params.
It waits for the started process to end and then passes back its return code (aka errorlevel). But it is a Windows application, in a batch file you have to put a "start /wait" in front.
Some programms do not work and end immediately in the System context.
Up to V1.2 this worked under XP only if the Sysinternal ProcessExplorer was running before, it seems that it changes the process access privileges to gather all the information but forgets to restore the found privileges.

Usage:

RunAsSystem [-min|-max|-normal|-noact|-hid] [-low|-below|-normal|-above|-high] "executable" [params for executable]
Samples:
RunAsSystem "%windir%\regedit.exe"

RunAsSystem "%windir%\System32\cmd.exe" /k dir /s "C:\System Volume Information"

Download: RunAsSystem.zip

Last update: 05 Dec 2020

 

  CloseWindow V0.3 - closing windows
 
CloseWindow closes windows by commandline. For identifying the right window either the window text (the caption) or its class must be given at the commandline.
CloseWindow -text="windowtext" -class="windowclass"
Wildcards can be used.

Sample: Close all Windows Calculators

closewindow -text="Calculator" -count=999
Sample: Close Explorer window (XP) of drive U:
closewindow -text="U:\*" -class="ExploreWClass"
Sample: Close Explorer window (Vista+) of drive U:
closewindow -text="U:\*" -class="CabinetWClass"
The window class can be determined by my tool WinInfo

This works within the same user context only: If you want to close a program started "As Administrator" under Vista+ then CloseWindows must be started "As Administrator" too.

Download: closewindow.zip

Last update: 20 Feb 2016

 

  FindEXE V0.5 - find the full path to an executable file
 
FindEXE is a commandline tool which shows the path of an executable which Windows would start.

Samples:

FindExe calc

C:\Windows\System32\calc.exe


FindExe test.txt

C:\Windows\System32\notpad.exe

Download: findexe.zip

Last update: 15 June 2017

 

  Sleep - Console program that waits for n milliseconds
 
Sample for waiting 1 second:
sleep 1000

Download: sleep.zip

Last update: 7 June 2007

 

  BinHexDec - Convertor for Hex, Dec and Bin numbers
 
binhex

Download: BinHex.zip

Last update: 08 May 2021

 

  COM Name Arbiter Tool V1.0.5 - gives control over reserved COM port numbers
 
Whenever a new COM port is installed, Windows looks for the first never used number. This ensures that there are no conflicts when two of the devices are attached at the same time.

In real live the users do not use their devices (as USB to COM adaptors) at the same time, but the COM numbers increase and increase because the reservation is not removed when the COM port device is uninstalled from the Device Manager. After 25 years Microsoft finally fixed this in Windows 10 version 1903, here the reservation is removed when a device is uninstalled, so this tool isn't needed anymore...

Windows stores used COM port numbers in the registry in the value ComDB under
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\COM Name Arbiter
By default there are 32 bytes with 8 bits in each byte. A set bit makes a port number (1..256) reserved. Over time Windows might exceed 256 ports, COM Name Arbiter Tool can handle this.

Changes are written immediately to the registry, admin privileges are required.

Removing the reservation does not do anything else than making Windows reassign the number to a new device when it is attached.
As long as the new device is not attached at the same time as the device which had these COM port before there is no problem.
If the devices are attached at the same time then the second one will not start because it cannot create its "COMx" symbolic link. This happens too if a new device wants to get a port which is supposed to be free because its arbiter bit is not set but in fact the port is in use! So don't clean up to much...

The tool can also uninstall (remove) devices.

Started with parameter /c it performs silently the "Clear unused reservations" operation.
Started with parameter /r it performs silently the "Remove non-present devices" operation.

Screenshot:

ComNameArbiterTool

Download: ComNameArbiterTool.zip

Last update: 07 Nov 2021

 

  CreateFile Tester - Testing the Windows API call CreateFile
 
The CreateFile Tester is useful for testing different parameters for the Window API call CreateFile. Furthermore it can open files exclusively to test the behaviour of other programs when they try to open such an exclusiveley opened file.
Lots of storage information functions can be tested, the tool-tips of the buttons show some hints.

Screenshot:

createfiletest

Download: CreateFileTest.zip
VB6-Source: CreateFileTest_src.zip

Last update: 27 Oct 2020

 

  DeviceIoControl Code Decoder
 
Decodes Windows DeviceIoControl hex values or names as listed here (in both directions).

Screenshots:

screenshot

screenshot

Download: IoctlDecoder.zip

Last update: 22 Feb 2016

 

  LogWindowAtPoint - Logs Windows at a certain position
 
This tool is useful to identify randomly popping up windows.

Screenshot:

logwindowatpoint

Download: logwindowatpoint.zip

Last update: 10 April 2016

 

  LogForegroundWindow - Logs the Windows which get the input focus
 
This tool is useful to identify windows which steal the focus from the active window.

Screenshot:

logforegroundwindow

Download: logforegroundwindow.zip

Last update: 10 April 2016

 



 

Uwe Sieber

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