1.

Solve : Shutdown the XP machine via batch file?

Answer»

In order to reduce electricity consumption, I wanted either to shut down the system and save the files before shutting it down.
Since, i am working in 2-11 shift, I am planning to use Windows Scheduler to process my batch file.

For shutting down, I had written some code as:

@ECHO OFF
:START
SET /p sd=Your system will be shutdown at 11:30 PM. Please save the unsaved files [y or n]:
IF "%sd%"=="Y" GOTO:SHUTDOWN
IF "%sd%"=="y" GOTO:SHUTDOWN
IF "%sd%"=="N" GOTO:EOF
IF "%sd%"=="n" GOTO:EOF
ECHO Incorrect Answer... Please Try Again
PAUSE
GOTO:START
:SHUTDOWN
c:\windows\system32\shutdown -s -f -t 120

The problem is that if I lock the system and leave for the day around 10 PM without SAVING my files and the scheduler will shut it down at 11:15 PM, how would it save the files and the pages opened in the browsers. I don't want to LOOSE any data through this. Please guide me.

Thanks.
Don't use the -f to force the shutdown perhaps - that may not shut down the MACHINE if you left unsaved programs open.

I googled a command to hibernate and FOUND this command, if hibernation is enabled (untested): %windir%\system32\rundll32.exe PowrProf.dll, SetSuspendStateThanks for the quick reply.

But if I have locked my system without saving the files and I am out of office, I want it to automatically save it and then shut it down. If we don't force it to shut down, I don't think so that it will save them and shut it down. what do you say?Quote from: hemantbarmecha on February 06, 2013, 10:26:18 AM

I want it to automatically save it and then shut it down.

You cannot do this generically. How saving is handled depends on the program. Hibernation is the only alternative if you want to be able to restore state.I don't see hibernate option in Power Options folder. Any WAY out to make the pc go hibernate?Here's the batch file source:
pause
echo 1
shutdown /s /f
echo 2
Yet the file seems to loop at the shutdown command. Here's the output from the batch file:
C:\Documents and Settings\Kiley\Desktop>pause
Press any key to continue . . .
C:\Documents and Settings\Kiley\Desktop>echo 1
1
C:\Documents and Settings\Kiley\Desktop>shutdown /s /f
C:\Documents and Settings\Kiley\Desktop>pause
Press any key to continue . . .It's highly probable that you called the batch file 'shutdown.bat/cmd'

Rename it to something else.


Discussion

No Comment Found