![]() |
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-09-25 01:08 |
47,813 topics / 349,918 posts / today 1 new / 48,274 members |
| DOS批处理 & 脚本技术(批处理室) » Please provide the complete original Chinese content including the specific requirements for the batch processing so that I can accurately translate it. The current content "求个批处理,要求先检查系统时间(已解决)" is too brief. For example, what specific checks on the system time are needed? Is it to check if it's within a certain time range, or something else? Please provide the full relevant content. |
| Printable Version 3,136 / 19 |
| Floor1 qqfx | Posted 2007-01-26 22:31 |
| 新手上路 Posts 6 Credits 14 | |
|
Please provide the batch code content so that I can help you translate it. Just the text you provided above doesn't have the actual batch code yet. Please paste the specific batch code content that needs to be translated.
|
|
| Floor2 不得不爱 | Posted 2007-01-26 22:46 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
|
SET /a a=%time:~0,2%*60+%time:~3,2%
if %a% geq 480 if %a% leq 1080 (goto 下一步) GOTO :EOF :下一步 .......... |
|
| Floor3 SpikeKnox | Posted 2007-01-26 22:57 |
| 初级用户 Posts 28 Credits 116 | |
|
@Echo OFF
Set /a thisTime=%Time:~0,2% If %thisTime% LSS 8 Goto :End If %thisTime% GTR 17 Goto :End Echo Time is between 8:00-17:59 :: Run some code ... Goto :EOF :End Echo Time is LSS then 8:00 or GTR then 17:59 [ Last edited by SpikeKnox on 2007-1-26 at 09:59 AM ] |
|
| Floor4 qqfx | Posted 2007-01-26 23:11 |
| 新手上路 Posts 6 Credits 14 | |
| Floor5 qqfx | Posted 2007-01-26 23:46 |
| 新手上路 Posts 6 Credits 14 | |
|
A simple trial run was done, no problem.
SpikeKnox's (content) can be understood. Banban's computer can understand (it) |
|
| Floor6 redtek | Posted 2007-01-27 01:06 |
| 金牌会员 Posts 1,147 Credits 2,902 | |
|
Explanation of the moderator code on the second floor:
The above code (marked in red) is to take the hour in the %time% environment variable (obtained by intercepting the string method) For example: If the time shown in %time% is: 11:15:33.01 (that is: 11 o'clock and 15 minutes), then %time:~0,2% is to take two characters from the offset 0 start in the %time% variable. What is taken is the hour. %time:~0,2%*60, multiply the obtained hour by 60 (minutes), because one hour is 60 minutes, so the hour number obtained through the string interception function needs to be converted into the total number of minutes, so it needs to be multiplied by 60 again. Because converting hours to minutes is for the convenience of comparing a certain time range. +%time:~3,2%, when the hour is obtained and the hour is multiplied by 60 to convert it into minutes, it is not enough, because the minute number in the %time% variable is also needed, so %time:~3,2% (if the %time% time is: 11:15:33.01) then it is to take two characters starting from offset 3 (offset is calculated from 0), these two characters are the above (blue marked) "15". Because the number of hours has been converted into minutes, and then adding the number of minutes in %time%, the total number of minutes of the current time obtained in this way is more accurate. Converting to the total number of minutes can make it more convenient and simple to use IF for calculation (and can also perform addition and subtraction calculations and other special times or operations on the range of dates based on this principle...). leq 1080 (marked in green in the above code), here LEQ means less than or equal to. Its help information can be seen by using the IF /? command: EQU - equal NEQ - not equal LSS - less than LEQ - less than or equal to GTR - greater than GEQ - greater than or equal to The meaning of the above code refers to: less than or equal to 1080 minutes (18 o'clock: there are 18 hours from 0 o'clock to 6 o'clock in the evening, which is 18 hours * 60 minutes per hour, which is 1080 minutes) Then use minutes as the basic unit for comparison: IF the current time is greater than or equal to 480 minutes (that is, 480/60=8 hours, which is 8 o'clock in the morning) and the current time is less than or equal to 1080 minutes (1080/60=18 hours, which is 18 o'clock in the evening), as long as the time range is between these, this is what the building owner requires: if the current time is between 8 o'clock in the morning - 18 o'clock in the evening, execute a certain command... (Intercepting string knowledge: There is in the help information of SET /?) (Knowledge of %time%: There is at the end of the help information of SET /? about the dynamic environment variables that can be "called") (Knowledge of judging size and judgment: There is in the help information of IF /?) (Knowledge of Goto: There is in the help information of GOTO /?) For dates, a similar method of converting all to numerical values can also be used to determine the time attributes of a certain file: special applications such as being within a certain date range. [ Last edited by redtek on 2007-1-26 at 12:10 PM ] |
|
| Floor7 qqfx | Posted 2007-01-27 02:55 |
| 新手上路 Posts 6 Credits 14 | |
|
Bookmarked
|
|
| Floor8 htysm | Posted 2007-01-27 04:40 |
| 高级用户 Posts 415 Credits 866 | |
| Floor9 sweiwei | Posted 2007-01-29 10:29 |
| 初级用户 Posts 10 Credits 22 | |
|
Bookmarked
|
|
| Floor10 anqing | Posted 2007-02-08 22:58 |
| 高级用户 Posts 413 Credits 859 | |
|
Explained in great detail
|
|
| Floor11 jianren256 | Posted 2007-02-13 11:24 |
| 新手上路 Posts 7 Credits 14 | |
| Floor12 zh159 | Posted 2007-02-13 14:26 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
Originally posted by Can't Help Falling in Love at 2007-1-26 09:46: Modify to: This can set the time range very intuitively |
|
| Floor13 qqfx | Posted 2007-02-14 22:36 |
| 新手上路 Posts 6 Credits 14 | |
|
Now I can put this into the startup, and after booting, it will automatically connect to ADSL. I need to add a disconnect in the schedule. I have a time-based package from 8:00 to 18:00.)
|
|
| Floor14 blue812 | Posted 2007-02-15 06:42 |
| 初级用户 Posts 29 Credits 57 | |
|
Thank you very much for the detailed explanation from user 6th floor, I've learned something new again.
|
|
| Floor15 Eblis | Posted 2007-03-01 07:56 |
| 中级用户 Posts 108 Credits 251 From 湖南==>广州 | |
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |