Page 1 of 1
time sync errorlevel check
Posted: 17 May 2014 01:49
by mohdfraz
Hello,
I want that when this command runs
and it should generate error message for all other quotes then this below.
The command completed successfully.
So I know it did not worked successfully and needs my attention.
Thanks
Re: time sync errorlevel check
Posted: 17 May 2014 02:55
by foxidrive
Do you want to detect the message?
Code: Select all
w32tm /resync | find /i "The command completed successfully." >nul || an error occurred&pause
Re: time sync errorlevel check
Posted: 17 May 2014 04:14
by mohdfraz
foxidrive wrote:Do you want to detect the message?
Foxidrive,
Thank you very much,,,, You are great.
It Worked like a charm
I used this code for easier test,,,
Code: Select all
:loop
w32tm /resync | find /i "The command completed successfully." >nul ||Msg * Clock Not working.......
goto loop
Re: time sync errorlevel check
Posted: 01 May 2024 23:26
by drgt
Code: Select all
@echo off
:loop
echo Attempting Time Sync...
w32tm /resync | find /i "The command completed successfully." >nul || echo Sync Not Working, Retrying...&goto loop
echo Success!!!!!
pause
exit
Looping even if successfull.
What am I doing wrong?
Re: time sync errorlevel check
Posted: 02 May 2024 02:07
by miskox
Try this:
Code: Select all
@echo off
:loop
echo Attempting Time Sync...
w32tm /resync | find /i "The command completed successfully." >nul || (echo Sync Not Working, Retrying...&goto loop)
echo Success!!!!!
pause
exit
You should treat the 'echo' and 'goto' as one command. You need parentheses ().
Saso
Re: time sync errorlevel check
Posted: 02 May 2024 03:49
by drgt
Thank you Saso!