You can actually just delete the whole subkey. Windows recreates it. If you want to do it by saving a text file with a .reg extension, then this one below works. Notice that there is an extra line to also do the start menu, which can be removed if not wanted. The main thing here, as far as syntax is that "-" which means kill the whole subkey.
--------menufix.reg---------------------------
REGEDIT4
[-HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Favorites]
[-HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu]
------------------------------------------------
Problem is -- same problem as with doing the manual context-click on the MSIE menu bar, sort alphabetically -- Windows never saves this preference. So basically the fix is something you have to do all the time.
You could take a tactic such as first saving the *.reg file above, and then making a batch file (VBS or such might be more elegant, but it is bat is simple and familiar). The command would be like this below. A syntax note on this, the "/s" switch for regedit means silent, no prompt.
-----doit.bat-------------------------
regedit /s menufix.reg
cls
exit
--------------------------------------
That bat is not giving a path for menufix.reg; one could it it if needed. If already using an autoexec.bat, one could just copy the one line "regedit /s menufix.reg" into that file. Either add to the line the full path to wherever menufix.reg is stored, or put menufix.reg in the root of C.