Boot into safe mode. Then Start>run>msconfig, go to startup tab and see if you can uncheck the running of the command processor (CMD) or possibly the running of a batch-file (.bat).
It would be interesting to see the parameters of the command (what file is being executed) and to know why it was created and who/what program did it.
Post again for more help if needed.
I am running XP and for the past few days when my computer boots up I get a small black screen that says C:/Windows/System32/cmd at the top of it and it says shutdown, if I do not click the X button right away when it comes up my computer goes into shutting it's self down. I have done several restores to days before it started doing this but it still does it. Any help would be great! Thanks