| View previous topic :: View next topic |
| Author |
Message |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Wed Oct 16, 2002 9:17 pm Post subject: Set Windows Time? |
|
|
Is it possible to set the Windows time through VDS?
Thanks...  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Oct 16, 2002 9:32 pm Post subject: |
|
|
You can use VDS and a DOS batch file in Win9x...
| Code: |
LIST CREATE, 1
rem -- Substitute whatever date/time ya want in this format --
LIST ADD, 1, "echo."@datetime(mm-dd-yyyy)"|date"
LIST ADD, 1, "echo."@datetime(h:nn:a/p)"|time"
LIST SAVEFILE, 1, c:\setdate.bat
RUNZ command /c c:\setdate.bat, WAIT
rem -- Check the new date/time --
INFO Date" "@datetime(mm-dd-yyyy)@tab()@cr()@cr()Time" "@datetime(hh:nn:am/pm)
|
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Wed Oct 16, 2002 10:48 pm Post subject: |
|
|
Thanks for the idea, Mac.
You can set the time directly from VDS by using DOS instead of a batch file. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Wed Oct 16, 2002 10:49 pm Post subject: |
|
|
Oops...
That doesn't work...I will use the batch file instead...  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Oct 16, 2002 10:58 pm Post subject: |
|
|
Actually it does work straight from DOS. I use a
batch file to set one computer clock on my LAN,
so that's the reason I posted the batch example.
Just use these date/time formats:
| Code: |
RUNZ command /c "echo.02-02-2000|date"
RUNZ command /c "echo.2:30:p|time"
|
If anyone is curious how this works, it uses the same
DOS DATE and TIME commands that you use from
a DOS prompt to set the date and time.
The date/time (along with "echo." which serves as
an ENTER keystroke) is "piped" to the appropriate DOS
command (DATE or TIME) by using the "|" char.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Thu Oct 17, 2002 8:00 pm Post subject: |
|
|
Strange, it does not seem to work on my XP Computer.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Oct 17, 2002 8:34 pm Post subject: |
|
|
Well, I mentioned it works in Windows 9x...
I think XP doesn't have true DOS, but rather a
DOS emulator.
Anyone else have an idea to set the time from VDS?
Also, has anyone tried to run the DOS command.com
under XP as a "DOS" program? Or would it crash?
Just a thought...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Thu Oct 17, 2002 9:29 pm Post subject: |
|
|
I just noticed that it did set the date though... (Feb. 2, 2000)  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Oct 17, 2002 9:39 pm Post subject: |
|
|
Ya might check if your XP comp uses a different time
format, different separators (instead of the colons), etc.
If the DATE works, I'd think the TIME should too.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
MarkTrubo Contributor


Joined: 27 May 2001 Posts: 148 Location: Long Island, NY
|
Posted: Thu Oct 17, 2002 11:00 pm Post subject: |
|
|
On XP I've used:
%%ATOMICITEM = @file(%Z\TIMEBLANK.sav,T)
%%DATEREAL = @DATETIME(mm-dd-yyyy,%%ATOMICITEM)
run command.com
:DOSCHECK
IF @WINEXISTS(#ConsoleWindowClass)
WINDOW SEND, #ConsoleWindowClass, "DATE "%%DATEREAL@CR()
WAIT 2
WINDOW SEND, #ConsoleWindowClass, "EXIT"@CR()
GOTO STEP4
END
WAIT 1
GOTO DOSCHECK
:STEP4
This can be done much better, but this format works on XP. The timeblank.sav is a file on our network server that gets it's time stamp updated to atomic time every few seconds. |
|
| Back to top |
|
 |
Hortalonus Valued Contributor


Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Fri Oct 18, 2002 2:59 pm Post subject: |
|
|
| I believe that NT based systems require you to have administrator rights in order to change the system time... don't know if that's a factor for you or not FreezingFire. |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Fri Oct 18, 2002 8:28 pm Post subject: |
|
|
Administrator priveliges are only required for setting the time if the Administrator has configured the computer that way. In my case, this is not an issue.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
attreus Valued Newbie

Joined: 30 Jul 2002 Posts: 46 Location: Berlin/Germany
|
Posted: Mon Aug 18, 2003 10:31 pm Post subject: ... years later ... maybe somebody's still interested ... |
|
|
on xp or 2000 - systems you can use cmd.exe in a similar way that mac did with the dos-command.com
| Code: |
runh @windir(s)\cmd /c time 04:07
|
don't know about older nt-versions. |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Tue Aug 19, 2003 3:14 am Post subject: |
|
|
SetSystemTime API would be probably the most reliable way. You can refer "run as" replacement API if you want to do it from a non admin account under NT/2k/XP.
Someone can write an example. It needs a structure i think.
Good Luck _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
|