First Step: DISABLE FAST SHUTDOWN
(For Windows 98 only.)
Launch MSCONFIG. Click Advanced. Place a check mark in the box next to Disable fast shutdown.
NOTE: If the box is already marked, go to SECOND STEP. If the box is missing in Windows 98 SE, it means you have already applied the Shutdown Patch, which has permanently disabled Fast Shutdown and then removed the box.
Click OK, then OK again. Test Windows shutdown by restarting the computer. (For proper troubleshooting, click Start | Shut Down | Restart | OK. Give Windows three minutes to complete the process before concluding that it is hung. This same procedure is referred to in the following steps as, Test Windows shutdown.) Disabling fast shutdown may solve the problem; but if it doesnt, go on to SECOND STEP.
NOTE: If your computer hangs at shutdown, it uses Advanced Configuration and Power Interface (ACPI), and the Win98 Fast Shutdown feature is disabled, see here.
Second Step: STARTUP/SHUTDOWN TROUBLESHOOTING WIZARD
A shutdown troubleshooter is built right into Windows 98 and Windows ME. It will take you through many, but not all, of the steps recommended below. You may prefer this kind of walk-through on-screen troubleshooter. To access it, click Start | Help. In the window, type Troubleshooting. Click on the Troubleshooting entry in the menu. Scroll down the new list provided and click on Shutdown and Startup Troubleshooter (Win98) or Startup & Shutdown Troubleshooter (Win ME).
Microsoft also has an on-line version of this Startup/Shutdown Troubleshooting Wizard.
You can try one or the other version of Microsofts troubleshooter as your next option if you wish; or simply continue through the steps that follow.
Third Step: RULE OUT DAMAGED EXIT SOUND FILE
In Control Panel, double-click Sounds (or Sounds & Multimedia). In the Events box, click Exit Windows. In the Name box, click None. Click OK. Test Windows shutdown. If Windows does not hang, the problem may be a corrupt sound file. Restore the file from your Windows disk or from wherever you obtained it, then test Windows shutdown.
An interesting variation on this issue: Several correspondents have confirmed (in Windows ME) that if there is a shutdown problem and no Exit Windows sound, the shutdown problem was resolved by adding one! (I suspect this worked by slowing down their shutdown process, thereby circumventing some other problem.) If this describes your situation give it a try!
Fourth Step: RULE OUT CLOGGED TEMPORARY FILE FOLDERS
Manually deleting the contents of various temporary file folders may solve the shutdown problem. Though these files can be relocated on a given system, their default locations are usually on the C: drive. Folders you might want to manually clean include: TEMP, Temporary Internet Files, and MSDOWNLD.TMP.
If you have not moved them on your hard drive, the following links will take you to your main temporary folders: TEMP, Temporary Internet Files, MSDOWNLD.TMP.
Fifth Step: RULE OUT AUTOEXEC.BAT or CONFIG.SYS COMMAND LINE PROBLEMS
If there is neither an AUTOEXEC.BAT nor CONFIG.SYS file, or if both are empty in Win95/98, go to SIXTH STEP.
FOR WIN95/98: Rename AUTOEXEC.BAT and CONFIG.SYS to AUTOEXEC.TMP and CONFIG.TMP.
FOR WINDOWS ME: Launch MSCONFIG, click Selective Startup, uncheck the box Load Environment Variables.
After doing one of these procedures, test Windows shutdown. If it hangs, rename the files to the original names, or reset MSCONFIG to its prior status, and go to SIXTH STEP. If the system does not hang, rename the files and proceed with these steps:
Restart Windows and bring up the Boot Menu. Choose Step-By-Step Confirmation. Press Y at each of the following prompts if it occurs (press N for any other prompts):
Load DoubleSpace driver
Process the system registry
DEVICE=C:\WINDOWS\HIMEM.SYS
DEVICE=C:\WINDOWS\IFSHLP.SYS
Load the Windows graphical user interface
Load all Windows drivers
NOTE FOR WINDOWS ME: The above list needs to be tweaked a bit to adapt it to Win ME. I have not yet done this, so things will look a bit different. However, if you follow the instructions literally, and keep your common sense awake, you will do this just fine.
After Windows finishes loading, test Windows shutdown. If the system hangs, go to SIXTH STEP. If it shuts down properly, the problem may be caused by a command line in the AUTOEXEC.BAT or CONFIG.SYS file.
To determine which line is causing the problem, follow these steps: Restart Windows, bringing up the Boot Menu as before. Press Y for each of the prompts listed above, plus one additional command. Press N for all other prompts. (You will cycle through the additional lines, selecting a different additional command each time until you have gone through them all.) Each time, after Windows finishes loading, test Windows shutdown. Repeat the above until the shutdown problem occurs.
When the shutdown problem occurs, you will have identified the command causing the problem. Disable the command, using SYSEDIT to edit the file containing the command (in Win95 or 98), or MSCONFIG to remove the check mark in front of the problematic item (in Win98 or ME).
Sixth Step: RULE OUT VIRTUAL DEVICE DRIVER / SYSTEM.INI PROBLEMS
Launch SYSEDIT. Click on the SYSTEM.INI window. Examine the [386Enh] section. Place a semicolon (

at the beginning of each line that begins with DEVICE= and ends with .386. Save the changes and exit SYSEDIT.
NOTE: In Win98 and ME, you can use MSCONFIG and merely uncheck such lines in the [386Enh] section.
Reboot, then test Windows shutdown. If Windows hangs, restore the SYSTEM.INI file to its original configuration. If Windows does not hang during shutdown, a virtual device driver may be causing the problem. Contact the drivers manufacturer for assistance.
Seventh Step: RULE OUT WIN.INI COMMAND LINE PROBLEMS
Launch SYSEDIT. Click on the WIN.INI window and look for any lines beginning with LOAD= or RUN=. Place a semicolon (

at the beginning of these lines if they have entries following the equal (=) sign. Save the changes to the WIN.INI file and exit SYSEDIT.
NOTE: In Win98 and ME, you can use MSCONFIG and merely uncheck such lines on the WIN.INI tab.
If you did not make changes, go to EIGHTH STEP; otherwise, reboot and then test Windows shutdown. If Windows continues to hang, remove the semicolons, save the file and go to EIGHTH STEP. If Windows does not hang, one of the disabled program entries may be to blame. To determine the problem program, re-enable them one at a time by removing the semicolon and resaving the file (or reenabling in MSCONFIG). After each program is enabled, test Windows shutdown.
Eighth Step: RULE OUT PROGRAMS LOADED FROM STARTUP FOLDER
Restart Windows without any Startup folder programs loading.
FOR WIN98 or ME: Use MSCONFIG. Click Selective Startup. Remove the check mark from in front of Load startup group items. Restart Windows. FOR WIN95: Restart the computer and, as soon as the Windows desktop wallpaper appears, press and hold the SHIFT key until Win95 finishes loading. After doing one of these procedures, test Windows shutdown. If Windows hangs, go to NINTH STEP. If Windows shuts down properly, determine the culprit by ruling out the programs one-by-one:
FOR WIN98 or ME: Use MSCONFIG. On the Startup tab, place a check mark next to the first program item listed. Click OK, then OK.
FOR WIN95: Manually remove all but one of the shortcut icons from the Startup folder.
FOR ALL VERSIONS OF WINDOWS: Test Windows shutdown. If Windows shuts down properly, then the program that remained is not causing the problem. Restore another startup program per the appropriate method above. After each program is restored, test Windows shut down. Continue re-enabling programs until you either find the problem program (there may be more than one) or all programs have been restored.