Chatting from the Windows Command Prompt

If you want a private chat with a friend or client on you Network, you don't need to download any fancy program! All you need is your friends IP address and Command Prompt.

You can use the net send command, or we can create a batch file to do the job for you. This article simple provides a method of the latter.

Firstly, open Notepad and copy paste code below:

@echo off 
cls
echo MESSENGER 
set /p n=User: 
:start
set /p m=Message:
net send %n% %m% 
pause 
goto start

Now save this as messenger.bat

Run the messenger.bat file and in Command Prompt you should see:

MESSENGER
User:

At the User prompt, type the IP address of the computer you want to contact.

After this, you should see the Message prompt:

Message:

Now type in the message you wish to send. Before you press Enter it should look like this:

Note: The message can be a maximum of 128 characters and must be wrapped in double quotes if it contains a slash.

MESSENGER
User: 192.168.1.12
Message: Hi

Now all you need to do is press Enter and start chatting! Pressing Ctrl+C to terminate.

Other examples

All members of workgroup/domain

To send to all members of the current workgroup or domain, at the User prompt, enter a single asterisk/star (*). For example:

User: *

All local server members

To send a message to all the members of the current server. Type /users at the Users prompt. For example:

Users: /users

By Username

At the User prompt, you can also specify an individuals username for a local domain user instead of the IP address of their machine. For example:

User: mchurch

Troubleshooting

If the messenger.bat file isn't working, you might see the following error in Command Prompt:

'net' is not recognized as an internal
or external command, operable program
or batch file.

There are two ways to fix this error, but only one is a permanent solution...

  1. You can move the current working directory to be the path where the cmd.exe file is located so that Command Prompt knows how to run the net send command. Do this with the change directory (cd) command:
    C:\> cd c:\windows\system32\
    From there, you can run Messenger.bat command without seeing that error. However, this is only a temporary solution that you'll have to do all the time for every command.
  2. The real problem is that the current environment variable has not been set up correctly. Here's how to restore the proper environment variable necessary for Command Prompt to understand your commands in Windows XP:
    1. Open the Start menu and right-click My Computer.
    2. Choose Properties from that menu.
    3. Go into the Advanced tab.
    4. Select the Environment Variables button.
    5. In the bottom section called System Variables, select Path from the list.
    6. Choose the Edit button below the System Variables section.
    7. In the Edit System Variable text box, look for any paths that read exactly like:
    8. C:\Windows\system32
      or...
      %SystemRoot%\system32 
      You should only have one of the above listed...
      1. If none are listed — Go to the very end of the entry, type a semicolon and then enter the top path from above. For example:
      2. ;C:\Windows\system32
      3. Is one already there? — If so, it's most likely %SystemRoot%\system32. If so, change it to C:\Windows\system32 (so long as your Windows installation is on the C: drive). For example, you would change %SystemRoot%\system32 to C:\Windows\system32.

        Important: Do not edit any other variables.

      4. If there is no variables in this box — You can enter the above path without the semicolon since it's the only entry. For example:
        C:\Windows\system32
    9. Click OK a few times to save the changes and exit the System Properties window.
    10. Restart your computer.