Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

batch file: Net Send Messenger


  • Please log in to reply
2 replies to this topic
Ace_NoOne
  • Members
  • 299 posts
  • Last active: May 02 2008 08:19 AM
  • Joined: 10 Oct 2005
Hey guys,

I woke up at 0600h this morning and couldn't sleep anymore ("prä-senile Bettflucht" - don't think that translates into English :wink: ).
So I went to write a little batch file to entertain me at work, where we got Windows 2000 (as well as ball/non-optical mice and constantly crashing Outlook 2000 :roll: ) and the messenger service is not turned off.
Anyways, here's a simple batch file to send messages to other users in the network:
@ECHO OFF

:main
	REM CLS
	ECHO.
	ECHO --------------------------------------------------
	ECHO.
	ECHO Net Send Messenger
	ECHO.
	ECHO Enter recipient (User) and text (Message) to send a message.
	ECHO Leave the User blank to retain the previous recipient.
	ECHO Enter "exit" as User to terminate the messenger.
	ECHO.
	SET /P user=User:
	IF %user% == exit GOTO quit
	SET /P text=Message:
	GOTO sendMsg

:sendMsg
	ECHO.
	ECHO Sending "%text%" to "%user%"
	NET SEND %user% %text% - %username%
	REM PAUSE
	GOTO main

:quit
This code is loosely based on deckkeeper's example.

There's probably a billion similar - and better - scripts out there (especially because I hadn't used batch files in ages), but it gave me something to do...


PS: I just noticed that the line break char for the NET SEND command can't be pasted into this text field. Check out this site and copy the square-like char into this line:
NET SEND %user% %text%[line break] - %username%

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
Ähnliche habe ich auch (post-senile Bettflucht). Warum schreibst du das als ein Batch Datei? AHK kann das doch besser.

Ace_NoOne
  • Members
  • 299 posts
  • Last active: May 02 2008 08:19 AM
  • Joined: 10 Oct 2005
Laszlo, I wasn't aware that you speak German - or was I? Guess I can add "pre-senile memory loss" to the list. :oops:
As for the "bed desertion"; sleep is overrated anyway...

Anyways, of course AHK can do that better than my crappy batch script. But it just 'evolved' somehow when I stumbled across that example, that's why I continued down the batch path.
Plus, as I said, it was just a way to entertain myself, and it was kinda fun goin' old school again (at least that's what batch files are to me - the older generation might prefer to think of something like FORTRAN here)... :wink: