使用 Visual Basic 的 Ncat 或 netcat
Ncat or netcat using visual basic
抱歉,我不想这样做,但我没有得到任何答复 here:
我想 运行 vb 中的此代码:nc -l -p 1234 < installer.zip
或 ncat -l 1234 < installer.zip
我试过这个:
Dim p As New ProcessStartInfo
p.FileName = "Cmd.exe"
p.Arguments = "nc -l -p 1234 < installer.zip"
Process.Start(p)
还有这个:
Process.Start("nc.exe", "-l -p 1234 < installer.zip")
但使用其中任何一个都会给我错误:
使用 netcat <: forward host lookup failed:h_errno 11004: NO_DATA
使用 ncat Ncat: Got more than one port specification: 1234 < installer.zip.
但是,如果相同的代码(复制)是 运行 通过批处理文件它工作。
将整个命令放入批处理文件中。
NC.BAT:
nc -l -p 1234 < installer.zip
然后 运行 来自 VB 的批处理文件:
Process.Start("NC.BAT")
感谢 Rubik 和 Bill_Stewart 的回复。
这两种方法都有效,但我更喜欢 Bill_Stewart 一种并将其标记为答案:
p.Arguments must start with /c and a space; e.g.: p.Arguments = "/c nc -l -p 1234 < installer.zip"
p.Arguments 必须以 /c 和一个 space 开头;例如:
p.Arguments = "/c nc -l -p 1234 < installer.zip"
抱歉,我不想这样做,但我没有得到任何答复 here:
我想 运行 vb 中的此代码:nc -l -p 1234 < installer.zip
或 ncat -l 1234 < installer.zip
我试过这个:
Dim p As New ProcessStartInfo
p.FileName = "Cmd.exe"
p.Arguments = "nc -l -p 1234 < installer.zip"
Process.Start(p)
还有这个:
Process.Start("nc.exe", "-l -p 1234 < installer.zip")
但使用其中任何一个都会给我错误:
使用 netcat <: forward host lookup failed:h_errno 11004: NO_DATA
使用 ncat Ncat: Got more than one port specification: 1234 < installer.zip.
但是,如果相同的代码(复制)是 运行 通过批处理文件它工作。
将整个命令放入批处理文件中。
NC.BAT:
nc -l -p 1234 < installer.zip
然后 运行 来自 VB 的批处理文件:
Process.Start("NC.BAT")
感谢 Rubik 和 Bill_Stewart 的回复。 这两种方法都有效,但我更喜欢 Bill_Stewart 一种并将其标记为答案:
p.Arguments must start with /c and a space; e.g.: p.Arguments = "/c nc -l -p 1234 < installer.zip"
p.Arguments 必须以 /c 和一个 space 开头;例如:
p.Arguments = "/c nc -l -p 1234 < installer.zip"