![]() |
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-29 08:05 |
47,816 topics / 349,916 posts / today 0 new / 48,265 members |
| DOS批处理 & 脚本技术(批处理室) » [With Conclusion] Importing Time from a Certain Website Using Bat |
| Printable Version 3,384 / 17 |
| Floor1 kennyfan | Posted 2006-10-18 05:50 |
| 中级用户 Posts 112 Credits 259 | |
|
Is there a way to write a BAT to import the time and date from the website http://www.time.ac.cn/stime.asp into the computer?
Brothers, give me some pointers! I'm getting dizzy thinking about it! [ Last edited by kennyfan on 2006-10-18 at 13:06 ] |
|
| Floor2 vkill | Posted 2006-10-18 06:05 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
|
VBS I don't know. I thought of using wget or VBS to download the web page source code, and then for
|
|
| Floor3 kennyfan | Posted 2006-10-18 06:09 |
| 中级用户 Posts 112 Credits 259 | |
|
The question is how to download? As long as the time part can be changed to text, it will be easy to handle.
|
|
| Floor4 lxmxn | Posted 2006-10-18 06:16 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Why not align the time of this website with the time of your computer, and then directly use %date%\%time% in the batch processing to call it? Wouldn't this be more convenient? |
|
| Floor5 ily2013 | Posted 2006-10-18 06:29 |
| 中级用户 Posts 83 Credits 247 | |
|
After I downloaded it with wget, I can extract the time with type + find, and then use echo time | time. I still need to think about the formal bat!
|
|
| Floor6 vkill | Posted 2006-10-18 06:34 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
Originally posted by kennyfan at 2006-10-10 06:09: wget "http://www.time.ac.cn/stime.asp" Just find stime.asp in the directory where wget is located |
|
| Floor7 kennyfan | Posted 2006-10-18 06:49 |
| 中级用户 Posts 112 Credits 259 | |
|
Hehe. Will download... Editing is a bit tedious, but should still be manageable! Hard
First, thank you to the above几位 brothers! [ Last edited by kennyfan on 2006-10-18 at 06:53 ] |
|
| Floor8 electronixtar | Posted 2006-10-18 09:05 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
Actually, the downloaded time is still inaccurate, hehe, it's related to the network speed
|
|
| Floor9 kennyfan | Posted 2006-10-18 09:20 |
| 中级用户 Posts 112 Credits 259 | |
|
555555 Don't dampen my spirits upstairs..! Got the code done hehe!
@echo off wget "http://www.time.ac.cn/stime.asp" for /f "tokens=4 delims=; " %%i in ('find /i "var hrs" stime.asp') do set hrs=%%i for /f "tokens=4 delims=; " %%i in ('find /i "var min" stime.asp') do set min=%%i for /f "tokens=4 delims=; " %%i in ('find /i "var sec" stime.asp') do set sec=%%i time %hrs%:%min%:%sec% pause |
|
| Floor10 lxmxn | Posted 2006-10-18 09:44 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Really don't understand why the original poster did this...
Is it just to know the "standard" Beijing time? |
|
| Floor11 electronixtar | Posted 2006-10-18 09:49 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
| Floor12 lxmxn | Posted 2006-10-18 10:53 |
| 版主 Posts 4,938 Credits 11,386 | |
|
electronixtar brother found another good command again `top``` |
|
| Floor13 electronixtar | Posted 2006-10-18 11:22 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
| Floor14 kennyfan | Posted 2006-10-18 12:59 |
| 中级用户 Posts 112 Credits 259 | |
|
There's no way. The computer has no power. Although the command w32tm.exe /resync can achieve time synchronization, it requires starting the WINDOWS TIME service. This consumes relatively more memory and is relatively slow!
|
|
| Floor15 electronixtar | Posted 2006-10-18 22:33 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
wsript.sleep 5000 is to wait for 5 seconds (5000 milliseconds) to let the web page fully load. You can adjust it appropriately according to your internet speed [ Last edited by electronixtar on 2006-10-18 at 22:37 ] |
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |