I have read this thread a week ago. I said I don't think it is a good idea to run windows under the control and with an additional instance of command.com in action. Hence the proposed solution by Laurence is far from satisfactory and, in fact, unsatisfactory.
I now find time to write up here a solution.
Everybody knows, if not read the Howtos of computing.net, how to construct the fully 32-bit lnk/icon for system shutdown via the commandline, namely,
rundll32.exe shell32,SHExitWindowsEx 1
or
rundll.exe user.exe,ExitWindows
As we target win98, I will stick to the first commandline hereinafter.
Now, the problem of the standard construction seems to be barring a multiple line shutdown process whereby some pre-shutdown batch job can be done before actual shutdown all by one click on an icon. That is why the question raised by John Lewery.
There are many way I can think of to accomplish this. The one (in fact, two) I propose here bears the most resemblance of the standard construction.
[1] Make a batch file, say Master.bat with the following construction :
call [drive:][path]\Slave.bat
rundll32.exe shell32,SHExitWindowsEx 5
Note : Why parameter 5, instead of 1? Because, as you will experience by yourself, if you use parameter 1, there will be an annoying popup window before shutdown asking you to exit the batch file under the virtual Dos machine. With 5, the exit will be forced which will give you the most satisfaction without bothering with the popup.
[2] Make another batch file, Slave.bat in the [drive:] and [path] as specified in the call statement in [1].
::-----Slave.bat-------
:: All the pre-shutdown house-keep jobs here
...
... all the batch job commands
...
::---------------------
[3] With Master.bat, make the pif/icon. The only detail you have to be careful, which is taken care of by default in fact, is to let the dos box sees the windows background in the advanced program setting. This is to assure that the 32-bit rundll32 etc run properly.
Now, you have got the job done. Just cut and paste the pif/icon to the desktop and the job is accomplished one click away.
A slight variation of the above construction is to keep only the rundll32 line in Master.bat, say, Master1.bat with one line only :
rundll32.exe shell32,SHExitWindowsEx 5
and specify the Slave.bat in the Master1.bat shutcut/icon program setting, namely,
cmdline : [drive':][path']\Master1.bat
and
batch file : [drive:][path]\Slave.bat
You accomplish the same.
Here you are. I can propose another solution without appealing to Dos batch file but instead using Windows SH. But that would be another story.
PS : I've edited the above in the little box, so my prose may be broken at places. But, you get the idea.