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-07-08 23:24
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Please help the experts to modify this batch processing about time View 3,596 Replies 26
Floor 16 Posted 2006-10-28 09:05 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline


  • From the content written in the code, the first 1 represents hours and the second 1 represents minutes.

  • To run the file at a specified time, you can consider the at command and the schtasks command. You can also use this batch script, just modify the code.

  • As for this "schtasks /delete /tn "zhang" /f", it means to delete the scheduled task with the task name "zhang".
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
ooaf +1 2007-12-31 16:15
Floor 17 Posted 2006-10-28 23:25 ·  中国 广西 柳州 电信
初级用户
Credits 25
Posts 14
Joined 2006-10-28 06:32
19-year member
UID 68613
Gender Male
Status Offline
I followed the above and tried it. I can already create tasks, but they can't run. Then I created a task myself and it prompted:

A new task has been created, but it may not run because account information cannot be set.
The specified error is:
0x80070005: Access is denied
Please try using the "Task" browse button to locate the application

The user I'm currently using is Administrator, which is a super user. Why can't I create tasks?
Floor 18 Posted 2006-10-28 23:27 ·  中国 四川 南充 电信
超级版主
★★★★
我爱DOS
Credits 5,310
Posts 2,044
Joined 2005-09-26 12:00
20-year member
UID 42843
Gender Male
From 四川南充
Status Offline
Floor 19 Posted 2006-10-28 23:38 ·  中国 广西 柳州 电信
初级用户
Credits 25
Posts 14
Joined 2006-10-28 06:32
19-year member
UID 68613
Gender Male
Status Offline
Enter gpedit.msc to bring up the Group Policy. Then, successively click "Computer Configuration" - "Windows Settings" - "Security Settings" - "Local Policies" - "Security Options". In the right - hand box, change "Accounts: Limit local accounts that have blank passwords to console logon only" to "Disabled", and it should be okay.
Floor 20 Posted 2006-10-28 23:44 ·  中国 浙江 温州 电信
中级用户
★★
Credits 458
Posts 196
Joined 2006-10-05 12:04
19-year member
UID 64614
Status Offline
Using VBScript's DateAdd() is simpler for MS...
Floor 21 Posted 2007-01-04 03:53 ·  中国 广东 深圳 联通
新手上路
Credits 16
Posts 7
Joined 2006-09-29 02:27
19-year member
UID 63994
Gender Male
From 河南省南阳市
Status Offline
No reply to post 13?
Are %next_hour% and !next_hour! the same?
Floor 22 Posted 2007-01-04 04:49 ·  中国 湖北 武汉 电信
初级用户
Credits 40
Posts 14
Joined 2006-12-27 11:38
19-year member
UID 74713
Gender Male
Status Offline
The avatar of "Must Love" is really ugly.....

Forgive me for speaking frankly!
Floor 23 Posted 2007-12-09 12:37 ·  中国 重庆 电信
中级用户
★★
Credits 235
Posts 109
Joined 2006-08-24 00:52
19-year member
UID 61161
Gender Male
Status Offline
Please provide the specific content that needs to be translated. You only provided "看了总要留句话在走", please clarify the full context so that I can accurately translate it.
Floor 24 Posted 2007-12-09 13:22 ·  中国 江苏 苏州 吴江区 电信
银牌会员
★★★
Credits 1,608
Posts 780
Joined 2007-10-07 10:19
18-year member
UID 99089
Gender Male
Status Offline
Originally posted by luobotou at 2007-1-4 03:53 AM:
No reply to post 13?
Are %next_hour% and !next_hour! the same?


Variable delay
Different effects!
Floor 25 Posted 2007-12-12 22:18 ·  中国 广西 南宁 电信
初级用户
★★
Credits 127
Posts 59
Joined 2007-11-13 00:41
18-year member
UID 102491
Gender Female
Status Offline
Hehe In the past, I encountered the same problem regarding time. I'll also leave a message. Up~~~
Floor 26 Posted 2007-12-26 18:32 ·  中国 湖北 武汉 电信
中级用户
★★
Credits 313
Posts 162
Joined 2007-04-02 06:45
19-year member
UID 83693
Gender Male
Status Offline
To achieve running d.bat at intervals of seconds, is the following correct, calculation of seconds?

Run d.bat every 10s, and re-add the task, loop

setlocal ENABLEDELAYEDEXPANSION
at /delete /yes
rem Here 10 is the interval time (s), you can adjust it yourself as needed
set/a next_hour=%time:~0,2%
set/a next_minute=1%time:~3,2%-100
set/a next_second=1%time:~6,2%-100+10
if %next_second% GEQ 60 (set /a next_second=!next_second!-60
set /a next_minute=!next_minute!+1
if %next_minute% GEQ 60 (set /a next_minute=!next_minute!-60
set /a next_hour=!next_hour!+1
if !next_hour! GEQ 24 set /a next_hour=!next_hour!-24)
)
at !next_hour!:!next_minute!:!next_second! d:\d.bat
endlocal

Save as d.bat

[ Last edited by ooaf on 2007-12-26 at 06:36 PM ]
Floor 27 Posted 2007-12-31 14:50 ·  中国 北京 联通
新手上路
Credits 12
Posts 6
Joined 2007-12-31 13:30
18-year member
UID 107312
Gender Male
Status Offline
Learning
Forum Jump: