![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-08 04:43 |
48,041 topics / 350,128 posts / today 3 new / 48,253 members |
| DOS批处理 & 脚本技术(批处理室) » Batch scripts for LAN chatting, which can learn most batch processing commands. |
| Printable Version 4,367 / 33 |
| Floor1 jellord | Posted 2007-04-03 12:10 |
| 初级用户 Posts 26 Credits 92 | |
|
The following is the tool program for LAN chat that I wrote. Although it doesn't have much value, it uses most batch commands, including some important commands and more difficult ones. I'm posting it, hoping that new friends learning batch processing will like it. I believe it's very valuable for everyone to learn and understand relevant batch commands. This is the modified version
@echo off title LAN Chat Tool color 1f MODE con: COLS=54 lines=34 :choose cls echo\ echo ┏━━━━━━━━━━━━━━━━━━━┓ echo ┃ ┃ echo ┃ LAN Chat Tool ┃ echo ┃ copyright by jellord ┃ echo ┗━━━━━━━━━━━━━━━━━━━┛ echo\ echo. echo =============================================== echo. echo To use this software, you must ensure that your computer has started the Windows Messenger service. Otherwise, please follow these methods to enable it: echo. echo 1. Enter net start messenger in the Run box; echo 2. Enter the Control Panel, then enter Administrative Tools, and then enter the Service program, find the messenger service and start it. echo. echo =============================================== echo. set /p choose=Please choose (1/Quit program and start messenger service; 2/Continue): if /i "%choose%"=="1" goto if /i "%choose%"=="2" goto 2 echo. echo. ---------Incorrect input, please try again!----------&&echo.&&pause&&goto choose :2 if exist ip.txt del /q ip.txt cls echo\ echo ┏━━━━━━━━━━━━━━━━━━━┓ echo ┃ ┃ echo ┃ LAN Chat Tool ┃ echo ┃ copyright by jellord ┃ echo ┗━━━━━━━━━━━━━━━━━━━┛ echo\ echo Scanning online users in the LAN, please wait... echo. echo ///////////////////////////////////////////////////// echo IP Computer Name setlocal enabledelayedexpansion net view|find "\\">lan.txt for /f "usebackq" %%j in ('lan.txt') do ( if "%%~zj"=="0" ( echo Sorry, there are currently no active users online!&&echo Sorry, there are currently no active users online! >ip.txt ) else ( for /f "tokens=1" %%i in (lan.txt) do ( set co=%%i set co=!co:\\=! ping -w 1 -n 1 !co!|find /I "!co!">ping.txt for /f "tokens=2,3 delims= " %%a in (ping.txt) do if not "%%b"=="could" echo %%b %%a for /f "tokens=2,3 delims= " %%a in (ping.txt) do if not "%%b"=="could" echo %%b %%a >>ip.txt ) ) ) if exist lan.txt del /q lan.txt&if exist ping.txt del /q ping.txt echo. echo ///////////////////////////////////////////////////// echo The above shows the online users in the LAN currently echo. rem ============================================================================================ rem The part between the above slashes can also be implemented with the following code to achieve the same function, and it will not generate temporary text files at the same time. rem setlocal enabledelayedexpansion rem net view|find "\\">nul||echo Sorry, there are currently no active users online!||echo Sorry , there are currently no active users online!>ip.txt rem for /f "tokens=1" %%i in ('net view ^| find "\\"') do ( rem set co=%%i rem set co=!co:\\=! rem for /f "tokens=2,3 delims= " %%a in ('ping -w 1 -n 1 !co! ^| find /I "!co!"') do if not %%b"=="could" echo %%b %%a rem for /f "tokens=2,3 delims= " %%a in ('ping -w 1 -n 1 !co! ^| find /I "!co!"') do if not %%b"=="could" echo %%b %%a>>ip.txt rem ) rem pause rem ============================================================================================ :user set /p u=Please choose the computer name or IP of the other party (note the case): echo. type ip.txt|find "%u%">nul||echo. -----------Input is not in the scanning result, please try again!------------&&goto p type ip.txt|find "%u%">nul&&goto main :p echo. set /p l=Please choose (1/Insist on sending; press Enter to return): if "%l%"=="" echo.&goto user if "%l%"=="1" goto main echo. goto user :main cls echo. echo ┏━━━━━━━━━━━━━━━━━━━┓ echo ┃ 1: Send message 3: Re-select sending object ┃ echo ┃ 2: View chat history 4: Re-scan LAN ┃ echo ┃ 0: Quit program ┃ echo ┗━━━━━━━━━━━━━━━━━━━┛ echo. echo You are currently chatting with %u%... echo. set c= set /p c=Please make your choice: if /i "%c%"=="4" del /q ip.txt&cls&goto 2 if /i "%c%"=="3" cls&&echo.&&echo The last scanned online users are shown below :&&echo.-----------------------------------------------------&&type ip.txt&&echo.&&goto user if /i "%c%"=="0" if exist ip.txt del /q ip.txt&goto if /i "%c%"=="2" goto 3 if /i "%c%"=="1" goto work echo \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ echo Your choice is incorrect! echo Please re-select echo \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ pause goto main :work cls echo.----------------------------------------------------- echo. echo You are currently chatting with %u%... echo. echo You can press Enter to return to the previous menu during the chat echo. echo.----------------------------------------------------- set m= set /p m=Please enter the message you want to send: echo. echo. if "%m%"=="" ( goto main ) else ( echo You said to %u% at %date% %time%: %m%>>messege.txt echo.Sending message, please wait... net send %u% %m% pause goto work ) :3 echo.----------------------------------------------------- set /p t=Please choose (1/Display in current window; 2/Display in new window): if "%t%"=="1" goto t if "%t%"=="2" goto s echo ----------------------------------------------------- echo Incorrect choice! goto 3 :t cls echo.----------------------------------------------------- type messege.txt|more&pause goto main :s start messege.txt goto main [ Last edited by jellord on 2007-4-5 at 08:50 PM ] |
|
| Floor2 binghuochanmian | Posted 2007-04-03 12:45 |
| 初级用户 Posts 23 Credits 55 From 广东 | |
|
It's really powerful, but is it a bit too cumbersome?
|
|
| Floor3 flyinspace | Posted 2007-04-03 15:13 |
| 银牌会员 Posts 517 Credits 1,206 | |
|
Hehe, Windows provides us with NetMeeting. Why not use it?
|
|
| Floor4 jellord | Posted 2007-04-04 09:39 |
| 初级用户 Posts 26 Credits 92 | |
|
It has been made very clear above. The purpose of writing this is to learn and practice relevant batch processing commands. It is hoped that it can provide a good case material for beginners. As for other software that can be used, it is not within the consideration scope of me writing this code.
|
|
| Floor5 hwhan525 | Posted 2007-04-04 09:57 |
| 初级用户 Posts 31 Credits 82 | |
|
Thanks, the learning sample provided by the landlord!! Beginners need such things very much!!
|
|
| Floor6 htysm | Posted 2007-04-16 05:30 |
| 高级用户 Posts 415 Credits 866 | |
|
Such a good post actually sank.
|
|
| Floor7 juventusryp | Posted 2007-04-16 06:27 |
| 初级用户 Posts 40 Credits 88 | |
|
Good stuff, I'll support it, can learn from it
|
|
| Floor8 tongwandou | Posted 2007-04-22 05:09 |
| 初级用户 Posts 50 Credits 112 | |
|
Take it back and study it, thank you the thread starter!!!
|
|
| Floor9 zhjipt | Posted 2007-04-22 08:07 |
| 初级用户 Posts 16 Credits 40 | |
|
Support............Support
|
|
| Floor10 aibo28 | Posted 2007-04-22 12:51 |
| 新手上路 Posts 9 Credits 18 | |
|
Already bookmarked. Thanks. Learned a lot
|
|
| Floor11 jashonx | Posted 2007-04-24 09:28 |
| 初级用户 Posts 21 Credits 44 | |
|
Worth researching! Sample Text
|
|
| Floor12 huangxiaohao | Posted 2007-10-11 21:45 |
| 初级用户 Posts 15 Credits 29 | |
|
Support, the LZ has worked hard
|
|
| Floor13 Nickey | Posted 2007-10-12 00:45 |
| 初级用户 Posts 59 Credits 132 From GuangZhou | |
|
Learning...ing
Can you remove your advertisement? |
|
| Floor14 putao | Posted 2007-10-12 11:04 |
| 初级用户 Posts 41 Credits 80 | |
|
Got it~ Going back to study, thanks
|
|
| Floor15 mygoldnet | Posted 2007-10-12 21:20 |
| 初级用户 Posts 32 Credits 90 | |
Originally posted by jellord at 2007-4-4 09:39 AM: It's very useful and would be great to add it to the LAN Gomoku in batch processing. Gomoku needs shared folders, needs to generate files, and can't chat. |
|
| 1 2 3 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |