|
marryli
初级用户
 
积分 36
发帖 13
注册 2007-3-8
状态 离线
|
『楼 主』:
PING 的问题
使用 LLM 解释/回答一下
做个批处理
测试与某个IP地址连接是否正常
下面是我写的 很菜哈
ping 17.0.11.1 > a.txt
type a.txt | find "ms" && echo ----连接正常----
有不生成.txt文件的方法就能判断是否连通的吗?
谢谢
Make a batch script to test whether the connection to a certain IP address is normal. Below is what I wrote, very crude haha.
ping 17.0.11.1 > a.txt
type a.txt | find "ms" && echo ----Connection is normal----
Is there a way to determine connectivity without generating a .txt file?
Thanks
|
|
2007-3-8 11:14 |
|
|
marryli
初级用户
 
积分 36
发帖 13
注册 2007-3-8
状态 离线
|
『第 2 楼』:
没人回答吗?
使用 LLM 解释/回答一下
太晚了 都睡了?
呵呵
Too late, everyone is asleep?
Hehe
|
|
2007-3-8 12:08 |
|
|
xngem
新手上路

积分 4
发帖 2
注册 2006-9-3
状态 离线
|
|
2007-3-9 03:42 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
ping 127.0.0.1|find "ms" >nul&&echo OK
ping 127.0.0.1|find "ms" >nul&&echo OK
|
|
2007-3-9 05:22 |
|
|
blue812
初级用户
 
积分 57
发帖 29
注册 2006-9-27
状态 离线
|
|
2007-3-9 05:55 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
Originally posted by lxmxn at 2007-3-9 05:22:
ping 127.0.0.1|find "ms" >nul&&echo OK
怎么还写的这么复杂那?
ping -n 1 127.1>nul 2>nul &&(echo ok)
Originally posted by lxmxn at 2007-3-9 05:22:
ping 127.0.0.1|find "ms" >nul&&echo OK
Why is it written so complicated?
ping -n 1 127.1>nul 2>nul &&(echo ok)
|
|
2007-3-9 06:04 |
|
|
Snickoow
初级用户
  发粪涂墙
积分 30
发帖 16
注册 2007-3-8 来自 上海
状态 离线
|
|
2007-3-9 08:30 |
|
|
marryli
初级用户
 
积分 36
发帖 13
注册 2007-3-8
状态 离线
|
『第 8 楼』:
>nul是什么意思啊?
使用 LLM 解释/回答一下
经常看到这个东西,也在网查了.XP自带的帮助也查过了
还是没弄懂
哪位老大能给解释一下啊?
谢谢
Often see this thing, also checked on the net. Also checked in the XP built-in help. Still didn't understand. Which boss can give an explanation? Thanks
|
|
2007-3-10 08:36 |
|
|
hxmupdata
初级用户
 
积分 76
发帖 39
注册 2007-3-9
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
貌似ping -n 1 127.1>nul&&echo ok 就可以
2>nul 不懂讲讲
It seems that ping -n 1 127.1>nul&&echo ok is okay. What about 2>nul? Let me explain.
In the command line, 2>nul is used to redirect the standard error output (stderr) to the null device, which means to suppress the error messages. For example, if there is an error message that would normally be displayed, using 2>nul will make it not show up.
|

狐狸喜欢狡猾。。 |
|
2007-3-11 10:35 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
自己搜索啊,论坛搜索啊
Search by yourself, search in the forum
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2007-3-11 11:02 |
|
|
hxmupdata
初级用户
 
积分 76
发帖 39
注册 2007-3-9
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
Originally posted by marryli at 2007-3-7 22:14:
做个批处理
测试与某个IP地址连接是否正常
下面是我写的 很菜哈
ping 17.0.11.1 > a.txt
type a.txt | find "ms" && echo ----连接正常----
有 ...
set count=10
:again
set b=false
ping 17.0.11.1|find "ms"&&set b=ok&&echo ----连接正常------&&exit
if %b%==false echo -----连接不到------
set count=count-1 ::感觉这有点不对,....
if count==0 exit
goto again
Originally posted by marryli at 2007-3-7 22:14:
Make a batch script
Test if the connection to a certain IP address is normal
The following is what I wrote, very simple ha
ping 17.0.11.1 > a.txt
type a.txt | find "ms" && echo ----Connection normal----
There is ...
set count=10
:again
set b=false
ping 17.0.11.1|find "ms"&&set b=ok&&echo ----Connection normal------&&exit
if %b%==false echo -----Can't connect------
set count=count-1 ::Feels a bit wrong,....
if count==0 exit
goto again
|

狐狸喜欢狡猾。。 |
|
2007-3-11 11:07 |
|
|
hxmupdata
初级用户
 
积分 76
发帖 39
注册 2007-3-9
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
>是重定向
命令的输出默认在cmd显示出来
使用>就不会显示出来了
>nul 释放输出
>It's redirection. The output of the command is displayed in cmd by default. Using > won't display it.
>nul releases the output
|

狐狸喜欢狡猾。。 |
|
2007-3-11 11:43 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
Originally posted by hxmupdata at 2007-3-10 22:07:
set count=10
:again
set b=false
ping 17.0.11.1|find "ms"&&set b=ok&&echo ----连接正常------&&exit
if %b%==false echo -----连接不到------
set count=count-1 ::感觉这有点不对,....
if count==0 exit
goto again
用 set 作算术运算应该加上参数 "/a","set /a count=count-1"
Last edited by lxmxn on 2007-3-15 at 11:29 AM ]
Originally posted by hxmupdata at 2007-3-10 22:07:
set count=10
:again
set b=false
ping 17.0.11.1|find "ms"&&set b=ok&&echo ----连接正常------&&exit
if %b%==false echo -----连接不到------
set count=count-1 ::感觉这有点不对,....
if count==0 exit
goto again
To perform arithmetic operations with set, you should add the "/a" parameter. It should be "set /a count=count-1"
Last edited by lxmxn on 2007-3-15 at 11:29 AM ]
|
|
2007-3-12 00:43 |
|
|
hxmupdata
初级用户
 
积分 76
发帖 39
注册 2007-3-9
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
Originally posted by lxmxn at 2007-3-11 11:43:
用 set 作算术运算应该加上参数 "/a","set /a count==count-1"
哦 知道了 刚学习 平时都用别的语言编程的.........
Originally posted by lxmxn at 2007-3-11 11:43:
You should add the parameter "/a" when using set for arithmetic operations, "set /a count==count-1"
Oh, I see. I'm just learning. I usually program in other languages...
|

狐狸喜欢狡猾。。 |
|
2007-3-12 06:20 |
|
|
hxmupdata
初级用户
 
积分 76
发帖 39
注册 2007-3-9
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
问一句如果不加/a count=count-1后count为多少啊?为什么......
我自己理解的不知道对不对
Ask a question: If you don't add "/a count=count-1", what will the value of count be? Why...
I don't know if my own understanding is correct
|

狐狸喜欢狡猾。。 |
|
2007-3-12 06:26 |
|