首页 > 开发 > PowerShell > 正文

Windows Powershell 执行外部命令

2020-05-30 20:15:06
字体:
来源:转载
供稿:网友

Powershell 能够像CMD一样很好的执行外部命令。

通过netstat查看网络端口状态

PS C:/PS> netstatActive Connections Proto Local Address     Foreign Address    State TCP  192.168.0.100:3049  192.168.0.88:7575    ESTABLISHED TCP  192.168.0.100:3052  192.168.0.88:7575    ESTABLISHED TCP  192.168.0.100:3061  192.168.0.88:7575    ESTABLISHED

通过IPConfig查看自己的网络配置

PS C:/PS> ipconfigWindows IP ConfigurationEthernet adapter Local Area Connection:  Connection-specific DNS Suffix . : www.mossfly.com  Link-local IPv6 Address . . . . . : fe80::b9dd:91e33:33f0:7885%10  IPv4 Address. . . . . . . . . . . : 192.168.140.100  Subnet Mask . . . . . . . . . . . : 255.255.252.0  Default Gateway . . . . . . . . . : 192.168.140.1Tunnel adapter isatap.www.mossfly.com:  Connection-specific DNS Suffix . : www.mossfly.com  Link-local IPv6 Address . . . . . : fe80::5efe:192.168.140.100%11  Default Gateway . . . . . . . . . :Tunnel adapter Teredo Tunneling Pseudo-Interface:  Media State . . . . . . . . . . . : Media disconnected  Connection-specific DNS Suffix . :

route print查看路由信息

PS C:/PS> route printIPv4 Route Table===========================================================================Active Routes:Network Destination    Netmask     Gateway    Interface Metric     0.0.0.0     0.0.0.0   192.168.140.1  192.168.140.100   20    192.0.0.0    255.0.0.0     On-link     192.0.0.1  306    192.0.0.1 255.255.255.255     On-link     192.0.0.1  306 192.255.255.255 255.255.255.255     On-link     192.0.0.1  306   192.168.140.0  255.255.252.0     On-link  192.168.140.100  276  192.168.140.100 255.255.255.255     On-link  192.168.140.100  276  192.168.143.255 255.255.255.255     On-link  192.168.140.100  276    224.0.0.0    240.0.0.0     On-link     192.0.0.1  306    224.0.0.0    240.0.0.0     On-link  192.168.140.100  276 255.255.255.255 255.255.255.255     On-link     192.0.0.1  306 255.255.255.255 255.255.255.255     On-link  192.168.140.100  276===========================================================================Persistent Routes: NoneIPv6 Route Table===========================================================================Active Routes: If Metric Network Destination   Gateway 1  306 ::1/128         On-link 10  276 fe80::/64        On-link 11  281 fe80::5efe:192.168.140.100/128                  On-link 10  276 fe80::b965:91f3:33a0:7285/128                  On-link 1  306 ff00::/8         On-link 10  276 ff00::/8         On-link===========================================================================Persistent Routes: None

启动CMD控制台

启动CMD控制台键入cmd或者cmd.exe,退出cmd可以通过命令exit。

PS C:/PS> cmdMicrosoft Windows [Version 6.1.7601]Copyright (c) 2009 Microsoft Corporation. All rights reserved.C:/PS>exitPS C:/PS>            
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表