Re: Change time by one hour




"Lost in Microbiology" <LostinMicrobiology@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote
in message news:3B146256-F133-4EC4-A6A2-4BECDCE97D8E@xxxxxxxxxxxxxxxx


"Pegasus (MVP)" wrote:


"Lost in Microbiology" <LostinMicrobiology@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote
in message news:A8E9F0D5-D4D0-4CB3-9A01-FB0747BEA20C@xxxxxxxxxxxxxxxx
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%


.



Relevant Pages

  • Re: How to program Enable, Disable drivers?
    ... Use this batch file to enable or disable a device ... setlocal enabledelayedexpansion ... echo Syntax: Device enable / disable ... Open a Command Prompt. ...
    (microsoft.public.windowsxp.general)
  • Re: Files deleted but free space doesnt increase
    ... The strange thing is that when I give you a self-logging batch file to ... echo %date% %time%> c:\test.txt ... command prompt to do that, ... deleting the files? ...
    (microsoft.public.windows.file_system)
  • Re: Script to MOVE file and leave a Shortcut to new location
    ... It also avoids re-creating any already existing shortcuts, so you could run it after your subsequent robocopy cleanup runs. ... @echo off ... Since your description about the source and target folders is rather vague, you may have to tweak the above batch file a little in order to suit your environment. ... You must test the batch file from the Command Prompt. ...
    (microsoft.public.windows.server.scripting)
  • Re: DOS Environment not working
    ... It just shows the variables set by windows on startup, ... The batch file does not fail because I ... installed a errorlevel statement to echo a message.... ... I run the batchfile at the command prompt, but when I check the variables: ...
    (microsoft.public.windowsxp.general)
  • Re: Change time by one hour
    ... current time from the command prompt, but I think this is beyond my ... You can get them to run this batch file: ... echo Setting the time to %NewTime% ... rem time %NewTime% ...
    (microsoft.public.windowsxp.general)