BackOffice Products
1760016 Members
2762 Online
108889 Solutions
New Discussion юеВ

variable in net send

 
joana_1
Frequent Advisor

variable in net send

Is it possible to put in the command Net Send message a variable.

Thanks
5 REPLIES 5
Roger Faucher
Honored Contributor

Re: variable in net send

Joana:

NET SEND /? from a Command Prompt in WINXP SP1 reveals:

The syntax of this command is:


NET SEND
{name | * | /DOMAIN[:name] | /USERS} message

Roger
Make a great day!

Roger
Jon Finley
Honored Contributor

Re: variable in net send

I did this to allow a broadcast to mutiple domains:
%1 will be the message I'm sending.

Usage: send "text of the message"

SEND.BAT

if %1!==! goto error
net send * %1
net send /DOMAIN:PHOENIX %1
goto end
:error
echo need to supply a message
:end


Jon
"Do or do not. There is no try!" - Yoda
joana_1
Frequent Advisor

Re: variable in net send

I'm sorry but I haven't understood the last answer. wat I want is to right a message saying Node down (Ip_of the node). This Ip is represented by the variable $a.

Joana
Artyom Voronchihin
Respected Contributor

Re: variable in net send

Hello !
Yes, it's possible. For example:

>rem set value of variable named IPaddr to 192.168.0.1
>set IPaddr=192.168.0.1

>rem sending message "IP 192.168.0.1 goes down" to computer called "test"
>net send test "IP %IPaddr% goes down"

Variable in output string will be replaced by it's value.
"Intel inside" is not a label, it's a warning.
Jon Finley
Honored Contributor

Re: variable in net send

If this variable ($a) is from a network monitoring program, then you should be able to issue something like the following from within your program (I'm assuming that your program uses the "exec" function to create a temporary command shell:

exec 'net send * Node down: ' + $a;

or...

cmd_str = "net send * Node down: " + $a;
exec &cmd_str;

Jon
"Do or do not. There is no try!" - Yoda