JSI Tip 0660 - How do I send a message to a list of users?

I have scripted two batch files.

SNDMSG "message text" User1 User2 User3 . . . Usern

@echo off
if \{%1\}

\{\} (echo usage: sndmsg "text" user-list) & (goto :EOF)
if \{%2\}

\{\} (echo usage: sndmsg "text" user-list) & (goto :EOF)
:LOOP
    if \{%2\}

\{\} goto :EOF
    net send %2 %1
    shift /2
goto :LOOP
:EOF


SNDMSGL "message text"  "<Drive:>\Folder\Filename.Ext"

@echo off
if \{%1\}

\{\} (echo usage: sndmsgl "text" user-list.txt) & (goto :EOF)
if \{%2\}==\{\} (echo usage: sndmsgl "text" user-list.txt) & (goto :EOF)
if not exist %2 (echo %2 not found) & (goto :EOF)
for /f "eol=; Tokens=*" %%i in (%2) do net send %%i %1
:EOF

where <Drive:>\Folder\Filename.Ext contains a list of users, one per line. Comments (; in column 1) are ignored.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish