PAUSE not work in Batch file

Hello Experts,

I have an issue that the 'PAUSE' won't work at all and I have tried all methods, but when I opted-out the 'IF NOT...' statement, it will work.

Thank you for your help.

=======================================
@echo off
Ping www.google.com | find "Reply"
      echo ping to google successful
      IF NOT echo ping to google unsuccessful
Ping www.yahoo.com | find "Reply"
      echo ping to yahoo successful
       IF NOT echo ping to yahoo unsuccessful
@PAUSE
=======================================
Lonelygirl_2012Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NVITEnd-user supportCommented:
Looks like a coding error. Do you mean this?
IF NOT %errorlevel%==0 echo ping to google unsuccessful

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Steve KnightIT ConsultancyCommented:
You may also be interested in these different ways to do the same thing.... && and || run the command after depending upon the result of the previous statement,  Second shows use of ELSE.

Steve

@echo off
Ping www.google.com -n 1 -w 100 | find "Reply" && (
   echo ping to google successful
) || (
   echo ping to google unsuccessful
)

Ping www.google.com -n 1 -w 100 | find "Reply"
If errorlevel 1 (
   echo ping to google unsuccessful
) ELSE (
   echo ping to google successful
)

Open in new window

Lonelygirl_2012Author Commented:
Thank you Steve Knight,

I wish I have to power to split the point for the two of you. Hope it not too late.
Steve KnightIT ConsultancyCommented:
Don't worry, saw you had already accepted after I submitted.
Bill PrewIT / Software Engineering ConsultantCommented:
@Lonelygirl_2012

If you do want to close the question differently you can use "Request Attention" and ask for the question to be reopened so you can close it differently.  Up to you...

~bp
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.