如何使用PHP和CMD命令向工作组发送消息?

I want to send a message to another PC in my workgroup.

I use Windows 7 Professional and Xampp server.

I use this code:

<?php
echo exec('C:\windows\system32\msg PCuser massage');
?>

But this is not working. So I tried another method like this:

<?php
echo exec('d:\test.bat');
?>

test.bat contains:

msg user 1

I open test.bat file and set it to run as admin so it will go straight to C:\windows\system32, and excecute the command.

But I get error message:

"C:\Windows\msg.exe is not a valid Win32 application"

But when I try to double click the .bat file, the pop up shows normally.

I want make a PHP form that can send a message to another computer like this:

PC name: ____

Massage: ____

<?php
$PCname=Input Post PC name;
$message=Input Post message;
echo exec('C:\windows\system32\msg'.$PCname.$message);
?>

So I can input the message and send then to specified PC.

UPDATE

I know I can run msg command without C:\windows\system32, but I still have the error message when I do this:

<?php
exec('msg user 1');
?>

I get again this error:

"C:\Windows\msg.exe is not a valid Win32 application"

I use href in my html to link to test.bat file and when I click on this hyperlink, I can download my test.bat file. When I click next to run it, then I get same error. I close my browser open my download folder and open test.bat file by double click and it runs normally.

So here are the questions:

  1. Can I run msg command in PHP or in browser?

  2. What is an alternate to do that? Which program can I use to run msg command?