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...
- 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 thenet send
command. Do this with the change directory (cd) command:C:\> cd c:\windows\system32\
From there, you can runMessenger.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. - 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:
- Open the Start menu and right-click My Computer.
- Choose Properties from that menu.
- Go into the Advanced tab.
- Select the Environment Variables button.
- In the bottom section called System Variables, select Path from the list.
- Choose the Edit button below the System Variables section.
- In the Edit System Variable text box, look for any paths that read exactly like:
- 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:
C:\Windows\system32
or...%SystemRoot%\system32
You should only have one of the above listed...;C:\Windows\system32
- 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.
- 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