因为这行代码后面 "> c:\IP.txt" 这个是 cmd.exe 的参数,而非 netsh.exe 的参数,你用 shell 是把它当成 netsh.exe 的了。
改成:
Shell("cmd /c netsh -c interface dump > c:\IP.txt")
【补充】
如果不想闪过 CMD 的窗口,可以 Shell 加参数 vbHide。