China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-12 17:24
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Original] How to create a batch file for automatic startup and shutdown View 1,062 Replies 5
Original Poster Posted 2009-09-19 00:42 ·  中国 贵州 贵阳 电信
新手上路
Credits 1
Posts 1
Joined 2009-09-18 10:34
16-year member
UID 152244
Gender Male
Status Offline
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.
Floor 2 Posted 2009-09-19 02:28 ·  中国 吉林 延边朝鲜族自治州 延吉市 电信
银牌会员
★★★
正在学习中的菜鸟...
Credits 1,039
Posts 897
Joined 2009-03-01 15:34
17-year member
UID 140302
Gender Male
From 在地狱中仰望天堂
Status Offline
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
Floor 3 Posted 2009-09-19 05:55 ·  中国 广东 肇庆 电信
中级用户
★★
Credits 206
Posts 103
Joined 2008-05-06 16:59
18-year member
UID 117911
Gender Male
From 广东 肇庆
Status Offline
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
Floor 4 Posted 2009-09-20 03:21 ·  中国 北京 朝阳区 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
What command is the poster above using to hibernate the computer, is it SHUTDOWN -H or not?

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 5 Posted 2009-09-20 04:49 ·  中国 广东 肇庆 广宁县 电信
中级用户
★★
Credits 206
Posts 103
Joined 2008-05-06 16:59
18-year member
UID 117911
Gender Male
From 广东 肇庆
Status Offline
I'm using this:
Rundll32.exe Powrprof.dll,SetSuspendStata

I haven't tried SHUTDOWN -H.
Floor 6 Posted 2009-09-20 05:13 ·  中国 北京 朝阳区 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
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.

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Forum Jump: