Close all Windows File Explorer windows, but don't kill the explorer.exe shell

You can use the command line utility NirCmd (freeware) (archive.org's mirror for the webpage; archive.org's mirror for the binary) and execute:

nircmd.exe win close class "CabinetWClass"

I use it on Windows 7 SP1 x64 Ultimate and it works as intended: it will close all Windows Explorer windows, but won't kill the explorer.exe process.

The program is supposed to work on Windows 9x/ME, Windows NT, Windows 2000, Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7, Windows 8, and Windows 10.