VB 里面运行的命令

来源:百度知道 编辑:UC知道 时间:2024/06/27 07:29:46
netsh interface IP set address "本地连接" static 192.168.0.2 255.255.255.0
netsh interface IP set dns "本地连接" static addr=202.96.64.68
netsh interface IP add dns "本地连接" addr=202.96.75.68

这几天dos命令可以在vb里面实现吗?该怎么弄啊?
回答者: 泠月冰辰 - 高级魔法师 六级 的方法可以实现,不过DNS那里只能实现一条,第二个dns命令添加不了,这是为什么啊?在用批处理的时候可以啊

shell "netsh interface IP set address ""本地连接"" static 192.168.0.2 255.255.255.0"
shell "netsh interface IP set dns ""本地连接"" static addr=202.96.64.68"
shell "netsh interface IP add dns ""本地连接"" addr=202.96.75.68"

good

shell"cmd.exe /c netsh interface IP set address " & chr(34) & "本地连接 " & chr(34) & " static 192.168.0.2 255.255.255.0"
shell"cmd.exe /c netsh interface IP set dns " & chr(34) & "本地连接" static addr=202.96.64.68"
shell"cmd.exe /c netsh interface IP add dns " & chr(34) & "本地连接 " & chr(34) & "addr=202.96.75.68"

这样才对!!

shell "cmd/c netsh interface IP set address ""本地连接"" static 192.168.0.2 255.255.255.0"

shell "cmd.exe /c netsh interface IP set address "本地连接" static 192.168.0.2 255.255.255.0 "