I'm working on a messenger batch file and I would like to log up to 10 recent recipients. However, I have never written a Batch file that logs data, so I'm not sure how to do it.
I searched Google for an answer, but I couldn't find what I'm looking for.
Here's the file:
- @echo off
title Messenger
sc config messenger start= demand
sc start messenger
cls
echo Welcome to Messenger!
echo.
set /p command=Computer Name or Internal IP Address:
echo.
set /p message=Message:
net send %command% %message%
echo.
echo Press "Enter" to send another message to the same computer, type "r" to view
echo recent recipients, or enter the Computer Name or Internal IP Address of another
echo computer to send a message to a different computer.
echo.
set /p command=^>
if /I "%command%"=="r" goto C
if /I "%command%"=="" goto A
goto B
:A
Cls
echo Recipient: %command%
set /p message=Message:
net send %command% %message%
echo.
echo Press "Enter" to send another message to the same computer, type "r" to view
echo recent recipients, or enter the Computer Name or Internal IP Address of another
echo computer to send a message to a different computer.
echo.
set /p command=^>
if /I "%command%"=="r" goto C
if /I "%command%"=="" goto A
goto B
:B
cls
echo Recipient: %command%
echo.
set /p message=Message:
net send %command% %message%
echo.
echo Press "Enter" to send another message to the same computer, type "r" to view
echo recent recipients, or enter the Computer Name or Internal IP Address of another
echo computer to send a message to a different computer.
echo.
set /p command=^>
if /I "%command%"=="r" goto C
if /I "%command%"=="" goto A
goto B
:C
cls
type UserLog.log
echo.
echo.
set /p command=Computer Name or Internal IP Address:
goto B
If you want to test it, type in your internal IP address (the one your router gives you) or your computer name as the recipient.
Thanks for any help!