[英]Output results of telnet and nmap to powershell/cmd session
So I have a serious fundamental gap in my knowledge that I'm sure has an easy answer, but after googling and looking on here, I can't find what I'm looking for: 因此,我在知识上存在严重的根本鸿沟,我肯定可以很容易地找到答案,但是在谷歌搜索并查看此处之后,我找不到想要的东西:
I use nmap
and telnet
on an almost daily basis for checking ports and logging into IP codecs
and I use them through either the powershell
or cmd
consoles, but when I tried to script something and run that script with either a .bat
or .ps1
suffix, either will give me the classic not recognized...
message. 我几乎每天都使用nmap
和telnet
来检查端口并登录IP codecs
并且通过powershell
或cmd
控制台使用它们,但是当我尝试编写某些脚本并使用.bat
或.ps1
后缀运行该脚本时, ,它们都会给我经典的not recognized...
消息。 But, if you're able to run it in the console, you should be able to script it, right? 但是,如果您能够在控制台中运行它,则应该能够对其编写脚本,对吗? How can one go about that? 一个人该怎么办?
Sample code for telnet
(that works in when inputting to either console, but not in script form): telnet
示例代码(在输入到任一控制台时均可使用,但不能以脚本形式输入):
telnet 192.168.87.21
Sample code for nmap
(again, works when inputting to either console, but not in script form): nmap
示例代码(同样,在输入到任一控制台时均可使用,但不能以脚本形式输入):
nmap -p 9999 192.168.87.101
Add a '&' symbol before 'telnet' like that: & telnet 127.0.0.1
像这样在“ telnet”之前添加“&”符号: & telnet 127.0.0.1
For more information how to run executables from Powershell look there: https://social.technet.microsoft.com/wiki/contents/articles/7703.powershell-running-executables.aspx 有关如何从Powershell运行可执行文件的更多信息,请参见: https : //social.technet.microsoft.com/wiki/contents/articles/7703.powershell-running-executables.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.