|  | 
 
| jellord 初级用户
 
   
 
 
 
 积分 92
 发帖 26
 注册 2007-3-10
 状态 离线
 | 
|  『楼 主』:
 局域网聊天的批处理,能学到绝大多数批处理命令。
 
使用 LLM 解释/回答一下 
 
 
以下是我写的局域网聊天的工具程序,虽说没有太大价值,但其中用到了多数的批处理命令,包括一些重要命令和难度较大的命令,发出来,希望学习批处理的新朋友会喜欢,相信对大家学习和理解相关批处理命令是很有价值的。这是修改后的版本
 @echo off
 
 title 局域网聊天工具
 color 1f
 MODE con: COLS=54 lines=34
 
 :choose
 cls
 echo\
 echo       ┏━━━━━━━━━━━━━━━━━━━┓
 echo       ┃                                      ┃
 echo       ┃            局域网聊天工具            ┃
 echo       ┃         copyright by jellord         ┃
 echo       ┗━━━━━━━━━━━━━━━━━━━┛
 echo\
 echo.
 echo    ===============================================
 echo.
 echo        使用本软件您必须确保您的计算机已经启动了
 echo        windows信使服务,否则请按照以下方法开启:
 echo.
 echo        1.在运行框中输入net start messenger;
 echo        2.在控制面板中进入管理工具, 然后进入
 echo          服务程序, 找到messenger服务并启动之。
 echo.
 echo    ===============================================
 echo.
 
 
 set /p choose=请选择(1/退出程序启动信使服务;2/继续):
 if /i "%choose%"=="1" goto
 if /i "%choose%"=="2" goto 2
 echo.
 echo. ---------输入错误,请重试!----------&&echo.&&pause&&goto choose
 
 
 :2
 if exist ip.txt del /q ip.txt
 cls
 echo\
 echo       ┏━━━━━━━━━━━━━━━━━━━┓
 echo       ┃                                      ┃
 echo       ┃            局域网聊天工具            ┃
 echo       ┃         copyright by jellord         ┃
 echo       ┗━━━━━━━━━━━━━━━━━━━┛
 echo\
 echo 正在扫描局域网在线用户,请稍等...
 echo.
 echo /////////////////////////////////////////////////////
 echo               IP              计算机名
 setlocal enabledelayedexpansion
 net view|find "\\">lan.txt
 for /f "usebackq" %%j in ('lan.txt') do (
 if "%%~zj"=="0" (
 echo           对不起,目前没有活跃用户在线!&&echo           对不起,目前没有活跃用户在线!
 
 >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 以上显示的是目前局域网内的在线用户
 echo.
 
 rem ============================================================================================
 rem 以上斜线之间部分也可以用下面的代码实现同样的功能,同时还不会产生临时性的文本文件。
 rem setlocal enabledelayedexpansion
 rem net view|find "\\">nul||echo           对不起,目前没有活跃用户在线!||echo           对不起
 
 ,目前没有活跃用户在线!>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=请选择对方的计算机名或ip(注意大小写):
 echo.
 type ip.txt|find "%u%">nul||echo. -----------输入不在扫描结果中,请重试!------------&&goto p
 type ip.txt|find "%u%">nul&&goto main
 
 :p
 echo.
 set /p l=请选择(1/坚持发送;回车返回):
 if "%l%"=="" echo.&goto user
 if "%l%"=="1" goto main
 echo.
 goto user
 
 
 :main
 cls
 echo.
 echo       ┏━━━━━━━━━━━━━━━━━━━┓
 echo       ┃ 1: 发送信息     3: 重新选择发送对象  ┃
 echo       ┃ 2: 查看聊天记录 4: 重新扫描局域网    ┃
 echo       ┃            0: 退出程序               ┃
 echo       ┗━━━━━━━━━━━━━━━━━━━┛
 echo.
 echo              您当前正在和 %u% 聊天中...
 echo.
 set c=
 set /p c=请做出您的选择:
 if /i "%c%"=="4" del /q ip.txt&cls&goto 2
 if /i "%c%"=="3" cls&&echo.&&echo 上次扫描的在线用户显示如下
 
 :&&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                    您的选择不正确!
 echo                      请重新选择
 echo \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
 pause
 goto main
 
 :work
 cls
 echo.-----------------------------------------------------
 echo.
 echo              您当前正在和 %u% 聊天中...
 echo.
 echo           聊天过程中可以按回车键返回上级菜单
 echo.
 echo.-----------------------------------------------------
 set m=
 set /p m=请输入你将要发送的信息:
 echo.
 echo.
 if "%m%"=="" (
 goto main
 ) else (
 echo 你于%date% %time%对%u%说: %m%>>messege.txt
 echo.正在发送信息,请稍等...
 net send %u% %m%
 pause
 goto work
 )
 
 :3
 echo.-----------------------------------------------------
 set /p t=请选择(1/当前窗口显示;2/新建窗口显示):
 if "%t%"=="1" goto t
 if "%t%"=="2" goto s
 echo -----------------------------------------------------
 echo                      错误的选择!
 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 ]
 
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 ]
 
 
 | 此帖被 +2 点积分  点击查看详情 | 评分人:【 htysm 】 | 分数: +2 | 时间:2007-4-16 05:31 | 
 | 
 
 
 
 |  | 
|  2007-4-3 12:10 |  | 
|  | 
 
| binghuochanmian 初级用户
 
   
 
 
 
 积分 55
 发帖 23
 注册 2006-12-22
 来自 广东
 状态 离线
 | 
| 『第 2 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
果然很强,只是会不会太烦琐了一点? 
It's really powerful, but is it a bit too cumbersome? 
 
 
 |  | 
|  2007-4-3 12:45 |  | 
|  | 
 
| flyinspace 银牌会员
 
      
 
 
 
 积分 1206
 发帖 517
 注册 2007-3-25
 状态 离线
 | 
| 『第 3 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
呵呵,windows给我们提供了netmeeting 。
 为什么不用呢?
 
Hehe, Windows provides us with NetMeeting. Why not use it? 
 
 
 
 |  
                  |  知,不觉多。不知,乃求知
 |  | 
|  2007-4-3 15:13 |  | 
|  | 
 
| jellord 初级用户
 
   
 
 
 
 积分 92
 发帖 26
 注册 2007-3-10
 状态 离线
 | 
| 『第 4 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
上面已经说的很清楚了,写这个的目的是学习实践批处理的相关命令,希望能给初学者一个好的案例材料。至于有其他的软件可以使用,不在我写该代码的考虑范围之内。 
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. 
 
 
 |  | 
|  2007-4-4 09:39 |  | 
|  | 
 
| hwhan525 初级用户
 
   
 
 
 
 积分 82
 发帖 31
 注册 2007-3-19
 状态 离线
 | 
| 『第 5 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
谢谢,楼主提供的学习样本!!初学者很需要这样的东西!! 
Thanks, the learning sample provided by the landlord!! Beginners need such things very much!! 
 
 
 |  | 
|  2007-4-4 09:57 |  | 
|  | 
 
| htysm 高级用户
 
     
 
 
 积分 866
 发帖 415
 注册 2005-12-4
 状态 离线
 |  | 
|  2007-4-16 05:30 |  | 
|  | 
 
| juventusryp 初级用户
 
   
 
 
 
 积分 88
 发帖 40
 注册 2006-12-26
 状态 离线
 | 
| 『第 7 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
好东西,我支持一下,可以学习下 
Good stuff, I'll support it, can learn from it 
 
 
 |  | 
|  2007-4-16 06:27 |  | 
|  | 
 
| tongwandou 初级用户
 
   
 
 
 
 积分 112
 发帖 50
 注册 2007-4-15
 状态 离线
 | 
| 『第 8 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
拿 回 去 研 究 一 下, 谢 谢 楼 主!!! 
Take it back and study it, thank you the thread starter!!! 
 
 
 |  | 
|  2007-4-22 05:09 |  | 
|  | 
 
| zhjipt 初级用户
 
   
 
 
 
 积分 40
 发帖 16
 注册 2006-12-3
 状态 离线
 |  | 
|  2007-4-22 08:07 |  | 
|  | 
 
| aibo28 新手上路
 
  
 
 
 
 积分 18
 发帖 9
 注册 2006-10-24
 状态 离线
 | 
| 『第 10 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
已经收藏了。感谢。学习不少 
Already bookmarked. Thanks. Learned a lot 
 
 
 |  | 
|  2007-4-22 12:51 |  | 
|  | 
 
| jashonx 初级用户
 
   铂金会员
 
 
 积分 44
 发帖 21
 注册 2007-4-15
 状态 离线
 | 
| 『第 11 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
值得研究!Sample Text 
Worth researching! Sample Text 
 
 
 |  | 
|  2007-4-24 09:28 |  | 
|  | 
 
| huangxiaohao 初级用户
 
   
 
 
 
 积分 29
 发帖 15
 注册 2007-10-6
 状态 离线
 |  | 
|  2007-10-11 21:45 |  | 
|  | 
 
| Nickey 初级用户
 
   
 
 
 积分 132
 发帖 59
 注册 2007-8-23
 来自 GuangZhou
 状态 离线
 | 
| 『第 13 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
学习...ing你的广告可不可以去掉呢?
 
Learning...ingCan you remove your advertisement?
 
 
 
 |  | 
|  2007-10-12 00:45 |  | 
|  | 
 
| putao 初级用户
 
   
 
 
 积分 80
 发帖 41
 注册 2007-10-5
 状态 离线
 | 
| 『第 14 楼』:
 下了~回去研究,谢谢
 
使用 LLM 解释/回答一下 
 
 
下了~回去研究,谢谢 
Got it~ Going back to study, thanks 
 
 
 
 |  
                  |  http://user.qzone.qq.com/182365808
 |  | 
|  2007-10-12 11:04 |  | 
|  | 
 
| mygoldnet 初级用户
 
   
 
 
 
 积分 90
 发帖 32
 注册 2007-1-14
 状态 离线
 | 
| 『第 15 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
Originally posted by jellord at 2007-4-4 09:39 AM:太有用了,加到批处理局域网五子棋中就很好。上面已经说的很清楚了,写这个的目的是学习实践批处理的相关命令,希望能给初学者一个好的案例材料。至于有其他的软件可以使用,不在我写该代码的考虑范围之内。
 
 五子棋要用共享文件夹,要产生文件,还不能聊天。
 
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.It has been made very clear above. The purpose of writing this is to learn and practice related batch processing commands, and it is hoped to provide a good case material for beginners. As for other software that can be used, it is not within the consideration range of writing this code.
 
 Gomoku needs shared folders, needs to generate files, and can't chat.
 
 
 
 |  | 
|  2007-10-12 21:20 |  |