|
sglxy
中级用户
   MS-DOS爱好者
积分 397
发帖 87
注册 2002-12-15
状态 离线
|
『楼 主』:
请问ping -n 1 127.1>nul是什么意思
使用 LLM 解释/回答一下
如题:在好几个批处理文件中看到“ping -n 1 127.1>nul”这个语句,请问ping -n 1 127.1>nul是什么意思?高手们能给讲讲吗?
As the question says: I saw the statement "ping -n 1 127.1>nul" in several batch files. What does "ping -n 1 127.1>nul" mean? Can the experts explain it?
|
|
2006-10-25 02:15 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
开始/运行 hh ntcmds.chm::/ntcmds.htm
Start/Run hh ntcmds.chm::/ntcmds.htm
|
|
2006-10-25 02:17 |
|
|
9527
银牌会员
     努力做坏人
积分 1185
发帖 438
注册 2006-8-28 来自 北京
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
主要是起到延时的作用,其他好像没有了 127.1这个是本机的回环地址相当于127.0.0.1 不光127.0.0.1 可以写成127.1的形式,其他的IP地址类型也是可以的,例如: 61.0.0.28也是可以写诚61.28的形式的
It mainly plays a role in delay, and there seems to be nothing else. 127.1 is the loopback address of this machine, which is equivalent to 127.0.0.1. Not only can 127.0.0.1 be written in the form of 127.1, but other types of IP addresses can also be, for example: 61.0.0.28 can also be written in the form of 61.28.
|

我今后在论坛的目标就是做个超级坏人!!! |
|
2006-10-25 02:20 |
|
|
sglxy
中级用户
   MS-DOS爱好者
积分 397
发帖 87
注册 2002-12-15
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
原来如此,谢谢两位朋友了!
Oh, I see. Thank you, two friends!
|
|
2006-10-25 02:28 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
|
2006-10-25 08:23 |
|
|
xyxFlysky
新手上路

积分 11
发帖 5
注册 2006-10-19
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
如果想屏蔽出错信息,可以用">nul 2>nul"屏蔽一切屏幕输出。
这句不太理解 -_-
If you want to block error messages, you can use ">nul 2>nul" to block all screen output.
This sentence is not very understandable -_-
此帖被 +1 点积分 点击查看详情 评分人:【 】 | 分数: +1 | 时间:2010-9-19 23:47 |
|
|

公道不在人心,是非只在时势 |
|
2006-10-25 10:38 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
                『第 7 楼』:
使用 LLM 解释/回答一下
Re:xyxFlysky
这个">nul 2>nul"可以屏蔽一切屏幕的输出可以这样理解:
假如你执行一个命令,但是不想在屏幕里看到这个命令的执行情况,可以使用">nul"就可以屏蔽命令在屏幕上的输出了,但是有的命令执行会出错,即使用了">nul"也不能屏蔽命令产生的信息,所以就在后面加" 2>nul"这个,就是">nul 2>nul",这样,不管命令是否正确的运行,都不会在屏幕看到这个命令所产生的屏幕显示了。
我们举一个简单的例子吧。
用"dir"命令可以显示当前目录的文件及文件夹列表,这时如果用"dir>nul",你就看不见dir命令执行的屏幕输出了,那么你再键入"dirr"会是什么情况呢?这时会显示" 'dirr' 不是内部命令,也不是外部命令,也不是批处理文件。",这时你也许会用"dirr>nul"来屏蔽这个错误提示,但是告诉你,你的猜想是错的,因为依然会出现" 'dirr' 不是内部命令,也不是外部命令,也不是批处理文件。"这个错误提示,这时如果你用"dirr>nul 2>nul"的话,你就在屏幕上看不到上面的出错提示了。不知道你再明白了没有。
如果你想了解更多的关于nul的说明,可以在论坛里面搜索一下,可以搜索到willsort兄详细及精彩的关于nul用法的解说的。
Last edited by lxmxn on 2006-10-26 at 12:33 AM ]
Re: xyxFlysky
The ">nul 2>nul" can block all screen output. Here's the understanding:
Suppose you execute a command but don't want to see the execution result on the screen. You can use " >nul" to block the output of the command on the screen. But some commands may produce error messages, and even using ">nul" can't block the information they generate. So adding " 2>nul" after it, that is, " >nul 2>nul", in this way, whether the command runs correctly or not, you won't see the screen display generated by this command.
Let's take a simple example.
The "dir" command can display the file and folder list of the current directory. At this time, if you use "dir >nul", you won't see the screen output of the dir command. Then what will happen if you type "dirr"? At this time, it will display " 'dirr' is not an internal command, nor an external command, nor a batch file." Then you may use "dirr >nul" to block this error message, but I tell you, your guess is wrong because the error message " 'dirr' is not an internal command, nor an external command, nor a batch file." will still appear. At this time, if you use "dirr >nul 2>nul", you won't see the above error message on the screen. I don't know if you understand it now.
If you want to know more about the explanation of nul, you can search in the forum. You can find the detailed and wonderful explanation of the usage of nul by brother willsort.
Last edited by lxmxn on 2006-10-26 at 12:33 AM ]
此帖被 +17 点积分 点击查看详情 评分人:【 sglxy 】 | 分数: +6 | 时间:2006-10-25 18:56 | 评分人:【 beeny 】 | 分数: +2 | 时间:2007-1-20 11:45 | 评分人:【 baomaboy 】 | 分数: +2 | 时间:2007-3-18 03:43 | 评分人:【 zhxy9804 】 | 分数: +2 | 时间:2007-3-22 10:57 | 评分人:【 haiou327 】 | 分数: +2 | 时间:2007-7-8 23:40 | 评分人:【 Nickey 】 | 分数: +2 | 时间:2008-2-15 18:02 | 评分人:【 】 | 分数: +1 | 时间:2009-11-17 22:39 |
|
|
|
2006-10-25 11:04 |
|
|
sglxy
中级用户
   MS-DOS爱好者
积分 397
发帖 87
注册 2002-12-15
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
Originally posted by lxmxn at 2006-10-25 11:04 AM:
Re:xyxFlysky
这个">nul 2>nul"可以屏蔽一切屏幕的输出可以这样理解:
假如你执行一个命令,但是不想在屏幕里看到 ...
lxmxn兄的讲解非常详细让我明白了以前百思不得其解的疑团,真的非常感谢你的耐心指点,谢谢!
Brother lxmxn, your explanation is very detailed and has helped me understand the puzzles that I couldn't figure out before. I really appreciate your patient guidance, thank you!
|
|
2006-10-25 18:55 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
例子举得真生动,欣赏~:)
The example is really vivid, appreciate it~ :)
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2006-10-25 20:45 |
|
|
amao
中级用户
  
积分 316
发帖 152
注册 2006-6-18
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
lxmxn兄头像很酷,其本人也很有耐心,赞一个
Brother lxmxn has a very cool avatar, and he himself is very patient. Thumbs up!
|
|
2006-10-26 00:05 |
|
|
inhell
新手上路

积分 10
发帖 4
注册 2006-10-25
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
如果懂linux的话 就很好理解空设备的概念了
If you understand Linux, it's easy to understand the concept of the null device
|
|
2006-10-26 03:00 |
|
|
yangzhiyi
中级用户
  
积分 261
发帖 123
注册 2006-6-6
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
ping -n 1 127.1>nul 这句怎么用啊,我正想要这样差不多的用法,
即执行 ping -n 1 127.1>nul 它会没任何信息,那么执行它干嘛?
贴上原文看看好吗
Last edited by yangzhiyi on 2006-10-29 at 12:51 AM ]
Ping -n 1 127.1>nul How to use this? I just want a similar usage. That is, executing ping -n 1 127.1>nul it will have no information. Then why execute it?
Last edited by yangzhiyi on 2006-10-29 at 12:51 AM ]
|
|
2006-10-29 00:49 |
|
|
zerocq
中级用户
  
积分 458
发帖 196
注册 2006-10-5
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
Originally posted by yangzhiyi at 2006-10-29 00:49:
ping -n 1 127.1>nul 这句怎么用啊,我正想要这样差不多的用法,
即执行 ping -n 1 127.1>nul 它会没任何信息,那么执行它干嘛?
贴上原文看看好吗
利用ping命令让脚本运行延时,就是等待多少秒再运行下边的
精确度不知道:D
我用wscript.sleep:D
Originally posted by yangzhiyi at 2006-10-29 00:49:
How to use the command "ping -n 1 127.1>nul"? I'm exactly looking for a similar usage.
That is, when you execute "ping -n 1 127.1>nul", there will be no any information. Then what is the purpose of executing it?
Please paste the original text for me to see.
Using the ping command to make the script run with a delay, that is, waiting for a few seconds before running the following.
I don't know the precision. :D
I use wscript.sleep:D
|
|
2006-10-29 00:53 |
|
|
yangzhiyi
中级用户
  
积分 261
发帖 123
注册 2006-6-6
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
狂,批命令分步执行的还需用到延时,通常都是用转跳吧,用ping -n 1 127.1>nul 来延时更狂。
Crazy, the step-by-step execution of batch commands still needs to use delays. Usually, it's done with jumps. Using ping -n 1 127.1>nul for delays is even crazier.
|
|
2006-10-29 01:02 |
|
|
zhwvip
初级用户
 
积分 29
发帖 14
注册 2006-8-2
状态 离线
|
|
2006-10-29 01:11 |
|