I'm trying to create a batch file which allow me to send message to mass users via cmd. Would appreciate any help as Im new to coding. Thank you.
Currently my code is like this.
@ECHO OFF
MSG /SERVER:hostname1 /TIME:60 /v /w * Hello User, Please update your laptop *
echo message send
MSG /SERVER:hostname2 /TIME:60 /v /w * Hello User, Please update your laptop *
echo message send
MSG /SERVER:hostname3 /TIME:60 /v /w * Hello User, Please update your laptop *
echo message send
pause
ECHO ON
I have a lot of hostnames thus I want to make my life easier. I'm trying to have a code something like this.
@ECHO OFF
SET hostname=hostname1, hostname2, hostname3
SET message=Hello User, Please update your laptop
MSG /SERVER:%hostname% /TIME:60 /v /w * %message%
echo message send
pause
ECHO ON