JSI Tip 9177. How do I delete the 'LEGACY_' keys on my legacy-free Windows XP, Windows Server 2003, or later computer?

NOTE: See Legacy-Free Hardware and BIOS Requirements.

NOTE: See Your legacy-free Windows XP or Windows Server 2003 computer shows a 'Serial' device in Device Manager?

I have scripted LEGACY_Free.bat to delete the LEGACY_<Device> sub-keys at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root.

The syntax for using LEGACY_Free.bat is:


NOTE: LEGACY_Free.bat uses REG.EXE, built into Windows XP, Windows Server 2003, and later operating systems.

LEGACY_Free.bat contains:

@echo off
for /f "Tokens=*" %%L in ('reg query HKLM\SYSTEM\CurrentControlSet\Enum\Root^|FIND /I "\LEGACY_"') do (
 set key=%%L
 set legacy=HKLM!key:~18!
 @echo REG DELETE !legacy! /F
 REG DELETE !legacy! /F

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.