Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: System commands

  1. #1
    New Coder
    Join Date
    Jul 2002
    Location
    Reno, NV
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    System commands

    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?

  • #2
    New Coder
    Join Date
    Jul 2002
    Location
    Reno, NV
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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????

  • #3
    New Coder
    Join Date
    Jul 2002
    Location
    Reno, NV
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #4
    Regular Coder
    Join Date
    Sep 2002
    Location
    Bulgaria
    Posts
    123
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Something like:
    print $message >> LPT1;
    ?

    Alex

  • #5
    New Coder
    Join Date
    Jul 2002
    Location
    Reno, NV
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Regular Coder
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    126
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could always just use something like:
    Code:
    print `msg /server:$server $user $msg`;
    Note the use of backticks for command execution.

  • #7
    New Coder
    Join Date
    Jul 2002
    Location
    Reno, NV
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •