Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello,
I'm really new to scripting with batch files, and I'm working on a program for a messaging system on our terminal server network. I had three issues to overcome. The first was how to send a single message using the msg command to a group of users, How to send a message to all users, and the last one I can't solve, which is sending to 2 or 10 users by typing in their login names. I'm mostly using the msg command to create this system, but I can't figure out or find a way to use the msg command to do this. It only seems to be capable of sending to a @list.txt of users, a single user, or all users.
This is an example of what I'm trying to do in my script, but I can only send to one user. I need to figure out a way to send to 2 - 15 users by typing in their login account names. All of the account names are a 4 digit number, 1901, 1902, 1903, etc.
Script:
@echo off
:A
Cls
echo MESSENGER
set /p a=User:
set /p b=Message:
msg %a% /Server:ts1 %b%
Pause
Goto AOn the user I need to be able to do multiples.
I would be so thankful for any help.
Sincerely,
~Waylen

@echo off & setLocal EnableDelayedExpansion
:loop
echo sending msg to %1
shift
if not %1'==' goto :loop
=====================================
If at first you don't succeed, you're about average.M2

I can't seem to get it right guys. This is what I'm trying, where am I messing up? The loop repeats to let me enter new users in each loop, then I hit the enter key with no value for a and it goes to the message, but when I hit enter it says that the message doesn't exist.
@echo off
:A
Cls
echo MESSENGER:loop
set a=
set /p a=user?
if "%a%" neq "" goto:loopset /p b=Message:
msg %a% /Server:ts1 %b%
Pause
Goto A

By using neq you've got it looping around doing nothing.
====================================
@echo off:A
:loop
set a=
set /p a=user?
if "%a%" equ "" goto :eofset /p b=Message:
msg %a% /Server:ts1 %b%
Pause
Goto :A
=====================================
If at first you don't succeed, you're about average.M2

![]() |
parallel port progm. in a...
|
For Loop in C
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |