Thursday, July 19, 2007

Shut down windows XP after a period of inactivity

Tell a computer to turn off if it hasn't been used for a while... Lets see, you can have a screen saver come on after say 10 mins. After 20 mins the screen turns off (the environment loves us here)... But there is no option to turn the whole thing off!!! Fortunately I have constructed a script to set-up things for this task using the following commands: This took me ages to find the exact things i was looking for... bloody GUI tools hiding the things you actually want to do. And for you lucky people here is my script:
@echo off

rem installs a script to shut down the computer after 10 mins: MYshutdown.bat
rem installs a script to cancel the shutdown: MYshutdownSTOP.bat
rem sets a schedule to run the shutdown script after 30 mins of inactivity

if not exist C:\MY mkdir C:\MY
if not exist C:\MY\scripts mkdir C:\MY\scripts
echo rem script by David Halliday to shut down computer > C:\MY\scripts\MYshutdown.bat
echo @echo off >> C:\MY\scripts\MYshutdown.bat
echo shutdown -s -f -t 600 -c "This workstation is shutting down to conserve power. Save all work now." >> C:\MY\scripts\MYshutdown.bat

echo shutdown -a > C:\MY\scripts\MYshutdownSTOP.bat

schtasks /create /TN MYshutdown /RU administrator /SC ONIDLE /I 30 /TR C:\MY\scripts\MYshutdown.bat



Blogger manish said...

good man its usefull

11:46 am  

Post a Comment

<< Home