0

Hi there, I have recently put together a net send messenger in a .bat file for a program of mine.
I would like to make it so, if the "net start messenger" line fails/has an error,
It echo's " messenger service is currently disabled on your computer. press F1 for instructions to enable this service."

anyone know how to code this?

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by pure_evil020
0

After the command, put echo %ERRORLEVEL% And observe the values printed in various outcomes.

You can test this variable with if/else when you know the values it can have.

0

In my opinion, the easiest way to do this is simply:

net start messenger || echo Messenger service is currently disabled on your computer. Press F1 for instructions to enable this service.

As opposed to && which would run the second command (the echo) only if the first command succeeds, || will run the second command only if the first command fails.

0

In my opinion, the easiest way to do this is simply:

net start messenger || echo Messenger service is currently disabled on your computer. Press F1 for instructions to enable this service.

As opposed to && which would run the second command (the echo) only if the first command succeeds, || will run the second command only if the first command fails.

thankyou! thats exactly what i was after.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.