BAT file for closing / restarting Windows 7 with additional pre-task

I have this problem: I tell my Windows 7 x64 to shut down or restart using the buttons in the Start Menu- and it does it. But first it does of course a bunch of things that take time [which are things that I did not implemented, just the default system behavior]; and apparently only after them it accesses all of the hard drives for check up or something. And as I have my archive drive set to turn off after 5 minutes of idle work, my reboot time is most of the time far much longer than it should- I can hear the HDD starting to spin, just so that Windows can finish the closing procedure. And if I want to avoid this I need to access my archive drive and go into some sub-folder that was in a folder I have accessed during my workflow [so that something new is opened and the drive has to wake up to execute this access from the drive itself and not from the RAM]

[And the reason I turn of the archive HDD is elimination of noise, some heat reduction, prevention of hardware wear and data corruptions, reduction of power consumption]

So does anyone know how to write a BAT file that would start at the same time execution of waking up of drive X and the rebooting of the system; and the alternative version that would start waking up drive X and also start turning off the whole computer, not waiting for the drive to start spinning with the full speed?

Apparently nobody in Microsoft had the foresight to imagine, that someone can have a turned off drive, that should be accessed at the beginning of the system closure and not at the end of it; despite the fact, that there is an option in Windows for turning off all of the idle drives. But come to think of it, it all makes typical Microsoft non-sense; because Windows allows for turning on that option only for all of the drives at once or for none at all [and so I have to use a third party software that turns off only that archive drive]

You could write a plain text file with the commands to change to a particular drive and show the files on it
like

QUELLTEXT
c:

dir
d:
dir
e:
dir
shutdown -s -f


the shutdown command has the switches to shutdown the local pc and force the closing of all applications.

Edit: unless you already know this, I would like to bring your attention the problem of machines that could in a way anticipate the actions of the humans. This excerpt is from "The Hitchhiker's Guide to the Galaxy" by Douglas Adams:

" SIRIUS CYBERNETICS CORPORATION

Elevators: Modern elevators are strange and complex entities. The ancient electric winch and "maximum-capacity-eight-persons" jobs bear as much relation to a Sirius Cybernetics Corporation Happy Vertical People Transporter as a packet of mixed nuts does to the entire west wing of the Sirian State Mental Hospital.

This is because they operate on the curious principle of "defocused temporal perception." In other words they have the capacity to see dimly into the immediate future, which enables the elevator to be on the right floor to pick you up even before you knew you wanted it, thus eliminating all the tedious chatting, relaxing and making friends that people were previously forced to do while waiting for elevators.

Not unnaturally, many elevators imbued with intelligence and precognition became terribly frustrated with the mindless business of going up and down, up and down, experimented briefly with the notion of going sideways, as a sort of existential protest demanded participation in the decision-making process and finally took to squatting in basements sulking.

An impoverished hitchhiker visiting any planets in the Sirius star system these days can pick up easy money working as a counselor for neurotic elevators."

Wouldn't it be an absolute shame to have a sulking computer only because it should have had the foresight to start the harddisk earlier?
No, this was no serious question. I hope you enjoyed the text.

QUOTE (ohrenkino @ Dec 4 2017, 19:58) <{POST_SNAPBACK}>
You could write a plain text file with the commands to change to a particular drive and show the files on it

like

c:
dir
d:
dir
e:
dir
shutdown -s -f

the shutdown command has the switches to shutdown the local pc and force the closing of all applications.


So a BAT file like this

X:
dir
shutdown -s -fseems to be neat solution, right?

Unfortunately it first spits out a window popup saying "Windows will shut down is less than a minute", then [even with almost all of my software already closed] shuts down the system for about 30 seconds, goes to the "Shutting down..." screen for another 15 seconds- and only then start to spin the drive X. I seems that it simply takes from memory what was on the list of main folder on drive X and thus skips the turning on the drive part [because the list is created from memory]. So in the end this solution takes whooping 100 seconds to close the system- not really doing what it should [immediately start to spin drives] while taking around 5 times more time than when I do this the old manual way

And if tell it to be more specific and go deeper, to list content if some sub-folders of drive X, then it really starts from creating such list. Unfortunately it stops at it- for 15 seconds needed for the spinning to start. And so the "Windows will shut down is less than a minute" pops up after 15 second. In the end, the whole process takes 60 seconds. Which is an improvement, but not enough of

So now I got to a a version where I first tell it to shut the hell up and then make the damn list

shutdown -s -f
X:\some folder\some sub-folder\content folder
dirIt takes now 45 seconds. An again- it is and improvement, but not enough as I can do it much quicker manually. But as it is to serve as a closer and not reboot, I can use that code

But how about a reboot- what is a code for that? Maybe a reboot will be somehow done quicker that the closing?

And maybe they are alternative ways / commands of closing the system [and turning of the hardware as I do not want to put it in some hibernation mode]?

And now I know where the jokes of elevators moving sideways comes from; a very well know joke in my country, coming out from a popular comedy

the command
shutdown /?
will show you a number of options - probably also an immediate mode (I think it is /p).
This was just a suggestion.

Yes, /?, the very basics of advanced handling of computers

[I must now prepare to commit harakiri]

You can add a timer to the equation and set it to zero. And it seems that in order for it to work properly [immediately that is], you have to go two folders deeper than you were at some point after waking up the system. So if my backup software creates copies in the "Folder", I cannot just make a list from the drive that it is on, a list of that "Folder" or its even "Sub-Folder"- I need to go one step deeper

So a code working like I need it to work [immediate restart and shutdown of the system, not starting to spin the drive after some time passes] I need to use

shutdown /r /f /t 0
X:\Folder\Sub-Folder\Sub-Sub-Folder
dir
shutdown /s /f /t 0
X:\Folder\Sub-Folder\Sub-Sub-Folder
dir

[You can now ohrenkino stand behind me with a sword]