where d is the drive the contains your CONFIG.SYS file.
Legal stuff and credits:
This program is FREE and it is highly recommended you back up your CONFIG.SYS file before using it. I have used it on my machine without any problems but of course YMMV.
The REXX procedure is based on information provided by Aaron Tiensivu.
General Info:
Basically the procedure will parse your CONFIG.SYS file and arrange the lines in the following order:
IFS Statements
BASEDEV Statements
SET Statements
DEVICE Statements
Anything that doesn't fall elsewhere
RUN Statements
In addition it will also remove any lines that are remarked as well as any blank lines.
It will NOT change your CONFIG.SYS file. The output of the sort procedure will be stored in a file called CONFIG.NEW in the current directory. After you have reviewed the file, just change the name and reboot.