There are a few commands built into Windows, but they aren't exactly ... convenient. Also, only sending messages is through command-line; received ones are displayed as annoying popups.
net send exists in all versions up to XP but is removed in Vista and 7. It uses NetBIOS.
net send <targetname> <text>
<targetname> can be either a user name or a computer.
net send tim Hi!
To receive messages you need to start the Messenger service.
sc config Messenger start= demand (or auto)
sc start Messenger
msg exists in XP Pro, and probably all Windows versions with Terminal Services.
msg /server <hostname> <targetname> <text>
Here <hostname> is the computer's name, <targetname> can be the receiving user's Windows username (but can be a * or a session name or session ID from qwinsta /server <hostname>), and <text> is obvious.
msg /server tims-pc tim Hi!
msg uses Terminal Services RPC and requires authentication. If you can receive an "Access Denied" message, run this on the remote computer:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v AllowRemoteRPC /t REG_DWORD /d 1 /f