View Full Version : System commands

09-21-2002, 11:57 AM
I'm running WinNT5.1 w/ Apache2.

in winnt theres a command run from the cmd prompt that allows you to send a console message to any user or computer on the network.
MSG /SERVER:servername [username] [message]

I want to write a script that will run that command and insert form variables where they need to be (servername,username,message,etc...)

Any Ideas?

09-21-2002, 01:07 PM
Well I'm a moron!

system ("msg /server:$server $user $msg");

that was easy.

Now, is there a way to display the output of that command in the browser????

09-23-2002, 10:51 AM
ok, here's what I did.

@server = system ("msg /server:$server \"$user\" \"$msg\"");
foreach $message (@server)
print $message;

Now it prints "0" if the command completes, and "256" if it doesn't.

Does anybody have any ideas how to get it to print command output?

09-23-2002, 11:34 AM
Something like:
print $message >> LPT1;
? :)


09-27-2002, 09:48 AM
not what i meant. print to screen. i've pretty much given up though. i just wrote a script to print messages based on error codes. it'll work for what I need it to do. thanks anyway everyone.

09-28-2002, 12:46 AM
You could always just use something like:

print `msg /server:$server $user $msg`;
Note the use of backticks for command execution.

09-28-2002, 09:11 AM
If there's an error, the output at the command promt gives a reason. User not connected, User does not exist, etc... I was trying to figure out a way to make the browser display that error. instead it just gave numbers. but i figured it out.

0 = OK
256 = Not Connected

For anything else it doesn't do anything. so i made a script that works with that.

But thatnks again for the help.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum