找回密码
 新注册用户
搜索
查看: 4234|回复: 8

[转帖]网络经典命令行

[复制链接]
发表于 2005-5-6 15:22:08 | 显示全部楼层 |阅读模式
1.最基本,最常用的,测试物理网络的
ping 192.168.10.88 -t ,参数-t是等待用户去中断测试

2.查看DNS、IP、Mac等
A.Win98:winipcfg
B.Win2000以上:Ipconfig/all

C.NSLOOKUP:如查看河北的DNS
C:\>nslookup
Default Server: ns.hesjptt.net.cn
Address: 202.99.160.68
>server 202.99.41.2 则将DNS改为了41.2
> pop.pcpop.com
Server: ns.hesjptt.net.cn
Address: 202.99.160.68

Non-authoritative answer:
Name: pop.pcpop.com
Address: 202.99.160.212

3.网络信使
Net send 计算机名/IP|* (广播) 传送内容,注意不能跨网段
net stop messenger 停止信使服务,也可以在面板-服务修改
net start messenger 开始信使服务

4.探测对方对方计算机名,所在的组、域及当前用户名
ping -a IP -t ,只显示NetBios名
nbtstat -a 192.168.10.146 比较全的

5.netstat -a 显示出你的计算机当前所开放的所有端口
netstat -s -e 比较详细的显示你的网络资料,包括TCP、UDP、ICMP 和 IP的统计等

6.探测arp绑定(动态和静态)列表,显示所有连接了我的计算机,显示对方IP和MAC地址
arp -a

7.在代理服务器端
捆绑IP和MAC地址,解决局域网内盗用IP:
ARP -s 192.168.10.59 00-50-ff-6c-08-75
解除网卡的IP与MAC地址的绑定:
arp -d 网卡IP

8.在网络邻居上隐藏你的计算机
net config server /hidden:yes
net config server /hidden:no 则为开启

9.几个net命令
A.显示当前工作组服务器列表 net view,当不带选项使用本命令时,它就会显示当前域或网络上的计算机上的列表。
比如:查看这个IP上的共享资源,就可以
C:\>net view 192.168.10.8
在 192.168.10.8 的共享资源
资源共享名 类型 用途 注释
--------------------------------------
网站服务 Disk
命令成功完成。

B.查看计算机上的用户帐号列表 net user
C.查看网络链接 net use
例如:net use z: \??.168.10.8\movie 将这个IP的movie共享目录映射为本地的Z盘

D.记录链接 net session
例如:
C:\>net session
计算机 用户名 客户类型 打开空闲时间
-------------------------------------------------------------------------------
\??.168.10.110 ROME Windows 2000 2195 0 00:03:12

\??.168.10.51 ROME Windows 2000 2195 0 00:00:39
命令成功完成。

10.路由跟踪命令
A.tracert pop.pcpop.com
B.pathping pop.pcpop.com 除了显示路由外,还提供325S的分析,计算丢失包的%

11.关于共享安全的几个命令
A.查看你机器的共享资源 net share
B.手工删除共享
net share c$ /d
net share d$ /d
net share ipc$ /d
net share admin$ /d
注意$后有空格。
C.增加一个共享:
c:\net share mymovie=e:\downloads\movie /users:1
mymovie 共享成功。
同时限制链接用户数为1人。

12.在DOS行下设置静态IP
A.设置静态IP
CMD
netsh
netsh>int
interface>ip
interface ip>set add "本地链接" static IP地址 mask gateway
B.查看IP设置
interface ip>show address
回复

使用道具 举报

发表于 2005-5-6 16:19:58 | 显示全部楼层
有些命令运行完了就自动关闭了,还没来得及看……
回复

使用道具 举报

发表于 2005-5-6 16:57:06 | 显示全部楼层
先在"运行"中运行cmd进入命令行模式后再执行相关的命令和程序就不会自动退出命令行模式了.
在命令行模式下执行exit命令可以退出cmd.exe
回复

使用道具 举报

发表于 2005-5-6 21:49:30 | 显示全部楼层
在cmd下运行的
回复

使用道具 举报

发表于 2005-5-6 22:10:52 | 显示全部楼层
CMD.EXE 用处也很大的

  1. Starts a new instance of the Windows command interpreter

  2. CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
  3.     [[/S] [/C | /K] string]

  4. /C      Carries out the command specified by string and then terminates
  5. /K      Carries out the command specified by string but remains
  6. /S      Modifies the treatment of string after /C or /K (see below)
  7. /Q      Turns echo off
  8. /D      Disable execution of AutoRun commands from registry (see below)
  9. /A      Causes the output of internal commands to a pipe or file to be ANSI
  10. /U      Causes the output of internal commands to a pipe or file to be
  11.         Unicode
  12. /T:fg   Sets the foreground/background colors (see COLOR /? for more info)
  13. /E:ON   Enable command extensions (see below)
  14. /E:OFF  Disable command extensions (see below)
  15. /F:ON   Enable file and directory name completion characters (see below)
  16. /F:OFF  Disable file and directory name completion characters (see below)
  17. /V:ON   Enable delayed environment variable expansion using ! as the
  18.         delimiter. For example, /V:ON would allow !var! to expand the
  19.         variable var at execution time.  The var syntax expands variables
  20.         at input time, which is quite a different thing when inside of a FOR
  21.         loop.
  22. /V:OFF  Disable delayed environment expansion.

  23. Note that multiple commands separated by the command separator '&&'
  24. are accepted for string if surrounded by quotes.  Also, for compatibility
  25. reasons, /X is the same as /E:ON, /Y is the same as /E:OFF and /R is the
  26. same as /C.  Any other switches are ignored.

  27. If /C or /K is specified, then the remainder of the command line after
  28. the switch is processed as a command line, where the following logic is
  29. used to process quote (") characters:

  30.     1.  If all of the following conditions are met, then quote characters
  31.         on the command line are preserved:

  32.         - no /S switch
  33.         - exactly two quote characters
  34.         - no special characters between the two quote characters,
  35.           where special is one of: &<>()@^|
  36.         - there are one or more whitespace characters between the
  37.           the two quote characters
  38.         - the string between the two quote characters is the name
  39.           of an executable file.

  40.     2.  Otherwise, old behavior is to see if the first character is
  41.         a quote character and if so, strip the leading character and
  42.         remove the last quote character on the command line, preserving
  43.         any text after the last quote character.

  44. If /D was NOT specified on the command line, then when CMD.EXE starts, it
  45. looks for the following REG_SZ/REG_EXPAND_SZ registry variables, and if
  46. either or both are present, they are executed first.

  47.     HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun

  48.         and/or

  49.     HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

  50. Command Extensions are enabled by default.  You may also disable
  51. extensions for a particular invocation by using the /E:OFF switch.  You
  52. can enable or disable extensions for all invocations of CMD.EXE on a
  53. machine and/or user logon session by setting either or both of the
  54. following REG_DWORD values in the registry using REGEDIT.EXE:

  55.     HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\EnableExtensions

  56.         and/or

  57.     HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions

  58. to either 0x1 or 0x0.  The user specific setting takes precedence over
  59. the machine setting.  The command line switches take precedence over the
  60. registry settings.

  61. The command extensions involve changes and/or additions to the following
  62. commands:

  63.     DEL or ERASE
  64.     COLOR
  65.     CD or CHDIR
  66.     MD or MKDIR
  67.     PROMPT
  68.     PUSHD
  69.     POPD
  70.     SET
  71.     SETLOCAL
  72.     ENDLOCAL
  73.     IF
  74.     FOR
  75.     CALL
  76.     SHIFT
  77.     GOTO
  78.     START (also includes changes to external command invocation)
  79.     ASSOC
  80.     FTYPE

  81. To get specific details, type commandname /? to view the specifics.

  82. Delayed environment variable expansion is NOT enabled by default.  You
  83. can enable or disable delayed environment variable expansion for a
  84. particular invocation of CMD.EXE with the /V:ON or /V:OFF switch.  You
  85. can enable or disable delayed expansion for all invocations of CMD.EXE on a
  86. machine and/or user logon session by setting either or both of the
  87. following REG_DWORD values in the registry using REGEDIT.EXE:

  88.     HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\DelayedExpansion

  89.         and/or

  90.     HKEY_CURRENT_USER\Software\Microsoft\Command Processor\DelayedExpansion

  91. to either 0x1 or 0x0.  The user specific setting takes precedence over
  92. the machine setting.  The command line switches take precedence over the
  93. registry settings.

  94. If delayed environment variable expansion is enabled, then the exclamation
  95. character can be used to substitute the value of an environment variable
  96. at execution time.

  97. You can enable or disable file name completion for a particular
  98. invocation of CMD.EXE with the /F:ON or /F:OFF switch.  You can enable
  99. or disable completion for all invocations of CMD.EXE on a machine and/or
  100. user logon session by setting either or both of the following REG_DWORD
  101. values in the registry using REGEDIT.EXE:

  102.     HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar
  103.     HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar

  104.         and/or

  105.     HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar
  106.     HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar

  107. with the hex value of a control character to use for a particular
  108. function (e.g.  0x4 is Ctrl-D and 0x6 is Ctrl-F).  The user specific
  109. settings take precedence over the machine settings.  The command line
  110. switches take precedence over the registry settings.

  111. If completion is enabled with the /F:ON switch, the two control
  112. characters used are Ctrl-D for directory name completion and Ctrl-F for
  113. file name completion.  To disable a particular completion character in
  114. the registry, use the value for space (0x20) as it is not a valid
  115. control character.

  116. Completion is invoked when you type either of the two control
  117. characters.  The completion function takes the path string to the left
  118. of the cursor appends a wild card character to it if none is already
  119. present and builds up a list of paths that match.  It then displays the
  120. first matching path.  If no paths match, it just beeps and leaves the
  121. display alone.  Thereafter, repeated pressing of the same control
  122. character will cycle through the list of matching paths.  Pressing the
  123. Shift key with the control character will move through the list
  124. backwards.  If you edit the line in any way and press the control
  125. character again, the saved list of matching paths is discarded and a new
  126. one generated.  The same occurs if you switch between file and directory
  127. name completion.  The only difference between the two control characters
  128. is the file completion character matches both file and directory names,
  129. while the directory completion character only matches directory names.
  130. If file completion is used on any of the built in directory commands
  131. (CD, MD or RD) then directory completion is assumed.

  132. The completion code deals correctly with file names that contain spaces
  133. or other special characters by placing quotes around the matching path.
  134. Also, if you back up, then invoke completion from within a line, the
  135. text to the right of the cursor at the point completion was invoked is
  136. discarded.

  137. The special characters that require quotes are:
  138.      <space>
  139.      &()[]{}^=;!'+,`~
复制代码
回复

使用道具 举报

 楼主| 发表于 2005-5-7 09:05:15 | 显示全部楼层

我帮楼上的把中文帖出来..........

Cmd

启动命令解释器 Cmd.exe 的新实例。如果在不含参数的情况下使用,则 cmd 显示 Windows XP 的版本和版权信息。

语法
cmd [[{/c|/k}] [/q] [/d] [{/a|/u}] [/t:fg] [/e:{on|off}] [/f:{on|off}] [/v:{on|off}] string]

参数
/c
执行 string 指定的命令,然后停止。
/k
执行 string 指定的命令并继续。
/s
修改位于 /c 或 /k 之后的 string 处理。
/q
关闭回显。
/d
禁用自动运行命令执行。
/a
创建美国国家标准协会 (ANSI) 输出。
/u
创建 Unicode 输出。
/t:fg
设置前景 f 和背景 g 的颜色。下表列出了可用作 f 和 g 的值的有效十六进制数字。
值 颜色
0 黑色
1 蓝色
2 绿
3 湖蓝色
4 红
5 紫色
6 黄
7 白色
8 灰色
9 浅蓝色
A 浅绿色
B 浅水绿
C 浅红色
D 浅紫色
E 浅黄色
F 亮白色

/e:on
启用命令扩展。
/e:off
禁用命令扩展。
/f:on
启用文件和目录名完成。
/f:off
禁用文件和目录名完成。
/v:on
启用延迟的环境变量扩展。
/v:off
禁用延迟的环境变量扩展。
string
指定要执行的命令。
/?
在命令提示符显示帮助。

注释
·使用多个命令
可以在 string 中使用由 && 分隔的多个命令,不过这些命令必须置于引号之中(例如,"command&&command&&command")。

·处理引号
如果指定了 /c 或 /k,则在满足下述所有条件的情况下,cmd 会处理 string 中的其余命令而将引号保留:
    ·未使用 /s。
    ·正确使用一对引号。
    ·在引号内未使用任何特殊字符(例如: &<>( ) @ ^ |}。
    ·在引号内使用了一个或多个空格子符。
    ·引号内的 string 为可执行文件的名称。
如果上述条件不能满足,则处理 string 时将首先检查它的第一个字符以验证其是否为左引号。如果第一个字符是左引号,则它会与右引号分离开。跟在右引号之后的任何文本都会得到保留。

·执行注册表子项
如果在 string 中未指定 /d,Cmd.exe 会查找下述注册表子项:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun\REG_SZ

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun REG_EXPAND_SZ

如果上述的一个注册表子项或两个都存在,则会在执行其他变量之前执行它们。

√ 警告

·编辑注册表不当可能会严重损坏您的系统。在更改注册表之前,应备份计算机上任何有价值的数据。

·启用和禁用命令扩展
在 Windows XP 中,命令扩展在默认情况下是启用的。对于特定过程可以使用 /e:off 将它们禁用。通过设置下述 REG_DWORD 值,可以在计算机上或用户会话中启用或禁用所有 cmd 命令行选项的扩展:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\EnableExtensions\REG_DWORD

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions\REG_DWORD

在注册表中使用 Regedit.exe 可以将 REG_DWORD 值设为 0×1(即启用)或 0×0(即禁用)。用户特定设置优先于计算机设置,并且命令行选项优先于注册表设置。

√  警告

·编辑注册表不当可能会严重损坏您的系统。在更改注册表之前,应备份计算机上任何有价值的数据。
·启用命令扩展后,会影响到下述命令:

assoc
call
chdir (cd)
color
del (erase)
endlocal
for
ftype
goto
if
mkdir (md)
popd
prompt
pushd
set
setlocal
shift
start(还包括将更改外部命令过程)

有关这些命令的详细信息,请参阅“相关主题”。

·启用延迟的环境变量扩展
启用延迟的环境变量扩展,可以使用感叹号字符来替代运行时的环境变量值。

·启用文件和目录名完成
默认情况下,禁用文件和目录名完成。对于特定的 cmd 命令处理,可以通过 /f:{on|off} 来启用或禁用该功能。通过设置下述 REG_DWORD 值,可以在计算机上或用户会话中启用或禁用所有 cmd 命令处理的文件和目录名完成:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD

要设置 REG_DWORD 值,请运行 Regedit.exe 并使用特定功能的控制字符的十六进制值(例如,用 0×9 表示 TAB 键,用 0×08 表示 BACKSPACE 键)。用户特定设置优先于计算机设置,并且命令行选项优先于注册表设置。

√  警告

·编辑注册表不当可能会严重损坏您的系统。在更改注册表之前,应备份计算机上任何有价值的数据。
如果使用 /f:on 启用了文件和目录名完成,则对于目录名完成,可使用 CTRL+D 组合键;而对于文件名完成,可使用 CTRL+F 组合键。要禁用注册表中特定字符的完成,请使用空格值 [0×20],因为空格不是有效的控制字符。

按 CTRL+D 或 CTRL+F 组合键时,cmd 会处理文件和目录名的完成操作。这些组合键的作用是在 string 后附加通配符(如果还未使用),并创建匹配的路径列表,然后显示第一个匹配的路径。如果所有路径都不匹配,文件和目录名完成操作会发出警告声,并且不更改所显示的内容。要逐个查看匹配路径列表中的路径,请重复按 CTRL+D 或 CTRL+F 组合键。要向后查看该列表,请在按 SHIFT 的同时按 CTRL+D 或 CTRL+F 组合键。要放弃已保存的匹配路径列表并生成新列表,可以编辑 string,然后按 CTRL+D 或 CTRL+F 组合键。如果在 CTRL+D 和 CTRL+F 组合键之间切换,将会放弃已保存的匹配路径列表并生成新列表。CTRL+D 组合键与 CTRL+F 组合键之间唯一的不同在于,CTRL+D 仅匹配目录名,而 CTRL+F 既匹配文件名,又匹配目录名。如果在任何内部目录命令(CD、MD 或 RD)中使用文件和目录名的完成,将仅使用目录的完成。

如果将匹配路径置于引号之中,则文件和目录名完成会正确地处理含有空格或特殊字符的文件名。

下述特殊字符需要有引号:& < > [ ] { } ^ = ; ! ' + , ` ~ [white space]

如果您提供的信息包含空格,请将文本置于引号之中(例如,"Computer Name")。

如果从 string 中处理文件和目录名完成操作,则位于光标右侧的 [Path] 的任意部分都将放弃(即在 string 中处理完成操作的位置)。
回复

使用道具 举报

发表于 2005-6-14 22:20:03 | 显示全部楼层
上面的这些一般在什么地方能学到啊?求教了
回复

使用道具 举报

 楼主| 发表于 2005-6-14 22:45:52 | 显示全部楼层
恒星的恒心  在 2005-6-14 22:20 发表:
上面的这些一般在什么地方能学到啊?求教了

最简单的方法,最容易找的地方——“开始”——“程序”——“帮助与支持”。
微软的“帮助与支持”是个好东东,值得经常去看看,经常去学习.......
回复

使用道具 举报

发表于 2005-11-30 22:20:02 | 显示全部楼层

咯详细的
辛苦了。。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 新注册用户

本版积分规则

论坛官方淘宝店开业啦~
欢迎大家多多支持基金会~

Archiver|手机版|小黑屋|中国分布式计算总站 ( 沪ICP备05042587号 )

GMT+8, 2024-10-1 13:19

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表