中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-12 14:43
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » [Original] How to create a batch file for automatic startup and shutdown
Printable Version  1,059 / 5
Floor1 zhanzerong Posted 2009-09-19 00:42
新手上路 Posts 1 Credits 1
I want to make a batch file that will automatically start up and shut down at a certain time, but I don't know how to write it. Please give me some guidance, experts.
Floor2 Hanyeguxing Posted 2009-09-19 02:28
银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂
Startup can't be done with a batch file...
To make the computer start up at a scheduled time, first make sure the computer uses an ATX power supply, the motherboard supports the clock wake-up function, and the operating system is Windows 98 or above. Then enter the BIOS settings at startup, select the "Power Management Setup" item, and set "Resume By Alarm" to enabled, that is, set it to "Enabled". Then in the time settings, set the "Data" item to 0, and in "Time" set the scheduled startup time. After setting it, press the 【F10】 key to save and exit
Floor3 mgq Posted 2009-09-19 05:55
中级用户 Posts 103 Credits 206 From 广东 肇庆
You can also set automatic startup in Task Scheduler. After setting the program to run and the run time, right-click the task's properties, click Settings, and check "Wake the computer to run this task". When shutting down, you must use hibernation for this to work.
Question 1:
Although automatic startup and running the program can be carried out at the specified time, after startup it always stops at the user selection screen, and I have to manually choose a user before it can enter the desktop. I'd appreciate it if an expert could point this out.
Question 2:
I tried using a batch file to hibernate and shut down, but then automatic startup no longer worked. I had to click Shut Down by hand and choose Hibernate for it to work. I don't understand why.
I hope an expert can write a complete batch file to achieve full automation
Floor4 yishanju Posted 2009-09-20 03:21
银牌会员 Posts 1,357 Credits 1,488
What command is the poster above using to hibernate the computer, is it SHUTDOWN -H or not?
Floor5 mgq Posted 2009-09-20 04:49
中级用户 Posts 103 Credits 206 From 广东 肇庆
I'm using this:
Rundll32.exe Powrprof.dll,SetSuspendStata

I haven't tried SHUTDOWN -H.
Floor6 yishanju Posted 2009-09-20 05:13
银牌会员 Posts 1,357 Credits 1,488
Then when you get a chance, try shutdown -h again.
-_- I'm too lazy to test it myself, hope you can reply with the test result, thanks..

If there are many computers that need automatic startup and shutdown, and they are all on the same LAN, you can set them to allow startup over the network, enable wake-on-LAN, and then centrally control the startup and shutdown of the other computers from one machine. Use the WOLCMD command for remote startup, and for remote startup you can use the SHUTDOWN command.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023