PC Review


Reply
Thread Tools Rate Thread

Change time by one hour

 
 
Lost in Microbiology
Guest
Posts: n/a
 
      7th Nov 2008
Hello All,

I tried using the command prompt to change the time by one hour, but
couldn't quite get it to work. What I am looking to do is perform a function
on the current system time. I have a remote computer that has a limited user
account and can't change the clock. I want to create a batch file, burn it to
a disk and let them run that. What I was trying was to add 01:00:00 to the
current time from the command prompt, but I think this is beyond my
abilities. Any help would be greatly appreciated.
 
Reply With Quote
 
 
 
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      7th Nov 2008

"Lost in Microbiology" <(E-Mail Removed)> wrote
in message news:A8E9F0D5-D4D0-4CB3-9A01-(E-Mail Removed)...
> Hello All,
>
> I tried using the command prompt to change the time by one hour, but
> couldn't quite get it to work. What I am looking to do is perform a
> function
> on the current system time. I have a remote computer that has a limited
> user
> account and can't change the clock. I want to create a batch file, burn it
> to
> a disk and let them run that. What I was trying was to add 01:00:00 to the
> current time from the command prompt, but I think this is beyond my
> abilities. Any help would be greatly appreciated.


As an afterthought: If your users run the command twice then they will
advance the clock by two hours!


 
Reply With Quote
 
Lost in Microbiology
Guest
Posts: n/a
 
      7th Nov 2008


"Pegasus (MVP)" wrote:

>
> "Lost in Microbiology" <(E-Mail Removed)> wrote
> in message news:A8E9F0D5-D4D0-4CB3-9A01-(E-Mail Removed)...
> > Hello All,
> >
> > I tried using the command prompt to change the time by one hour, but
> > couldn't quite get it to work. What I am looking to do is perform a
> > function
> > on the current system time. I have a remote computer that has a limited
> > user
> > account and can't change the clock. I want to create a batch file, burn it
> > to
> > a disk and let them run that. What I was trying was to add 01:00:00 to the
> > current time from the command prompt, but I think this is beyond my
> > abilities. Any help would be greatly appreciated.

>
> You can get them to run this batch file:
> @echo off
> for /F "delims=:" %%a in ('echo %time%') do set /a hour=%%a + 1
> for /F "tokens=2* delims=:" %%a in ('echo %time%') do set
> NewTime=%hour%:%%a:%%b
> echo Setting the time to %NewTime%
> rem time %NewTime%
>
> To test it, run it as it is. To activate it, remove the word "rem" in the
> last line.
>
> Note: Do not retype this batch file. Use copy & paste instead.
>
>


Thank you for the quick response. In testing I received the error 'New Time'
is not recognized as an internal or external command, and the command prompt
closes.

I just copied it and pasted into notepad, saved it as a .bat file, ALL Files
under file type. Is this just operator error?

THanks
 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      7th Nov 2008

"Lost in Microbiology" <(E-Mail Removed)> wrote
in message news:A8E9F0D5-D4D0-4CB3-9A01-(E-Mail Removed)...
> Hello All,
>
> I tried using the command prompt to change the time by one hour, but
> couldn't quite get it to work. What I am looking to do is perform a
> function
> on the current system time. I have a remote computer that has a limited
> user
> account and can't change the clock. I want to create a batch file, burn it
> to
> a disk and let them run that. What I was trying was to add 01:00:00 to the
> current time from the command prompt, but I think this is beyond my
> abilities. Any help would be greatly appreciated.


You can get them to run this batch file:
@echo off
for /F "delims=:" %%a in ('echo %time%') do set /a hour=%%a + 1
for /F "tokens=2* delims=:" %%a in ('echo %time%') do set
NewTime=%hour%:%%a:%%b
echo Setting the time to %NewTime%
rem time %NewTime%

To test it, run it as it is. To activate it, remove the word "rem" in the
last line.

Note: Do not retype this batch file. Use copy & paste instead.


 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      7th Nov 2008

"Lost in Microbiology" <(E-Mail Removed)> wrote
in message news:3B146256-F133-4EC4-A6A2-(E-Mail Removed)...
>
>
> "Pegasus (MVP)" wrote:
>
>>
>> "Lost in Microbiology" <(E-Mail Removed)>
>> wrote
>> in message news:A8E9F0D5-D4D0-4CB3-9A01-(E-Mail Removed)...
>> > Hello All,
>> >
>> > I tried using the command prompt to change the time by one hour, but
>> > couldn't quite get it to work. What I am looking to do is perform a
>> > function
>> > on the current system time. I have a remote computer that has a limited
>> > user
>> > account and can't change the clock. I want to create a batch file, burn
>> > it
>> > to
>> > a disk and let them run that. What I was trying was to add 01:00:00 to
>> > the
>> > current time from the command prompt, but I think this is beyond my
>> > abilities. Any help would be greatly appreciated.

>>
>> You can get them to run this batch file:
>> @echo off
>> for /F "delims=:" %%a in ('echo %time%') do set /a hour=%%a + 1
>> for /F "tokens=2* delims=:" %%a in ('echo %time%') do set
>> NewTime=%hour%:%%a:%%b
>> echo Setting the time to %NewTime%
>> rem time %NewTime%
>>
>> To test it, run it as it is. To activate it, remove the word "rem" in the
>> last line.
>>
>> Note: Do not retype this batch file. Use copy & paste instead.
>>
>>

>
> Thank you for the quick response. In testing I received the error 'New
> Time'
> is not recognized as an internal or external command, and the command
> prompt
> closes.
>
> I just copied it and pasted into notepad, saved it as a .bat file, ALL
> Files
> under file type. Is this just operator error?
>
> THanks


This happens because your newsreader broke up the batch file lines and you
did not "unbreak" them. Here is a line-numbered version of the same batch
file so that you can see clearly where each line starts:
1. @echo off
2. for /F "delims=:" %%a in ('echo %time%') do set /a hour=%%a + 1
3. for /F "tokens=2* delims=:" %%a in ('echo %time%') do set
NewTime=%hour%:%%a:%%b
4. echo Setting the time to %NewTime%
5. echo time %NewTime%


 
Reply With Quote
 
Lost in Microbiology
Guest
Posts: n/a
 
      7th Nov 2008
Thanks Pegasus, it worked brilliantly!

And yes, my typical user definitely has the ability to double click on the
..bat file about a hundred times to screw it up. Maybe I will go "Mission
Impossible" on them and send a CD that self destructs after one use.

Thanks again, you just improved my day by a factor of 100.

"Pegasus (MVP)" wrote:

>
> "Lost in Microbiology" <(E-Mail Removed)> wrote
> in message news:A8E9F0D5-D4D0-4CB3-9A01-(E-Mail Removed)...
> > Hello All,
> >
> > I tried using the command prompt to change the time by one hour, but
> > couldn't quite get it to work. What I am looking to do is perform a
> > function
> > on the current system time. I have a remote computer that has a limited
> > user
> > account and can't change the clock. I want to create a batch file, burn it
> > to
> > a disk and let them run that. What I was trying was to add 01:00:00 to the
> > current time from the command prompt, but I think this is beyond my
> > abilities. Any help would be greatly appreciated.

>
> As an afterthought: If your users run the command twice then they will
> advance the clock by two hours!
>
>
>

 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      7th Nov 2008

"Lost in Microbiology" <(E-Mail Removed)> wrote
in message news:CB3899EF-CC94-452D-88F5-(E-Mail Removed)...
> Thanks Pegasus, it worked brilliantly!
>
> And yes, my typical user definitely has the ability to double click on the
> .bat file about a hundred times to screw it up. Maybe I will go "Mission
> Impossible" on them and send a CD that self destructs after one use.
>
> Thanks again, you just improved my day by a factor of 100.
>


Thanks for the feedback. You can, of course, prevent your user from changing
the time more than once, e.g. like so:

01. @echo off
02. set FlagFile=c:\TimeChange.txt
03. if exist %FlagFile% (
04. echo %UserName% attempted to change the time on %date% at %time% >>
%FlagFile%
05. echo.
06. echo You have already advanced the PC's time. Can't do it twice . . .
07. goto Exit
08. )
09.
10. echo Time changed on %date% at %time% by %UserName% > %FlagFile%
11. for /F "delims=:" %%a in ('echo %time%') do set /a hour=%%a + 1
12. for /F "tokens=2* delims=:" %%a in ('echo %time%') do set
NewTime=%hour%:%%a:%%b
13. echo Setting the PC's time to %NewTime%
14. time %NewTime%
15.
16. :Exit
17. echo.
18. echo Press the Space Bar to close this window.
19. pause > nul



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calendar- change the time to words like 1st hour, 2nd hour, 3rd, . LG Microsoft Outlook Calendar 1 1st Mar 2009 04:10 AM
can i change the default meeting time from 1/2 hour to 1 hour? =?Utf-8?B?U2FyYWg=?= Microsoft Outlook Calendar 2 8th Jun 2007 01:43 AM
DST change caused Outlook to change appt time to 1 hour before =?Utf-8?B?SmFtaWUgSmFtZXM=?= Windows XP General 2 5th Apr 2006 08:01 PM
change am-pm to 24 hour time in Outlook =?Utf-8?B?aW5mb0Bib2ItY2hpc29sbS5jb20=?= Microsoft Outlook Calendar 3 4th Feb 2006 11:40 PM
change calendar to 24 hour time? =?Utf-8?B?b25lIHBldGVyIDUgZm91cnRlZW4=?= Microsoft Outlook Calendar 1 19th Jan 2006 12:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:10 AM.