如何使用Windows Universal App设置设备的IP地址?

时间:2015-08-05 16:04:42

标签: raspberry-pi win-universal-app iot windows-10-iot-core

我安装了一个安装了Windows 10 ioT的Raspberry Pi 2。如何在代码中静态设置IP地址?

5 个答案:

答案 0 :(得分:4)

您可以通过@JoseAntoniaDuraOlmos's answer here并运行" netsh"来执行此操作。

您可以使用Netsh命令行实用程序执行各种任务,包括在Windows中配置网络适配器的IP地址。

以下是配置静态IP地址的方法:

netsh interface ip set address"连接名称" static 192.168.0.101 255.255.255.0 192.168.0.1

注意:默认连接名称是有线适配器的本地连接和Wi-Fi适配器的无线网络连接。 IP地址顺序:客户端IP,子网掩码和网关IP。

以下是配置DNS地址的方法:

netsh interface ip add dns"连接名称" 208.67.222.222

netsh interface ip add dns"连接名称" 208.67.220.220指数= 2

注意:请记住替换连接名称和IP地址。

答案 1 :(得分:2)

现在可以直接使用Windows Device Portal(使用您的浏览器)

完成

enter image description here

答案 2 :(得分:1)

简短的回答是,目前无法通过代码完成。

答案 3 :(得分:0)

答案 4 :(得分:0)

我想这有点晚了,但经过多次研究,我发现迄今为止有效的唯一解决方案(C#)是使用SSH.NET(Renci)的ShellStream类:

 SshClient client = new SshClient(host, username, password);
 client.Connect();

 ShellStream stream = client.CreateShellStream("shellName", 80, 24, 800, 600, 1024);

然后,您可以通过StreamReader / StreamWriter操作流,并调用writeLine()将cmds引入Shell。

PS:您需要使用Nuget Manager安装SSH.NET,方法是在控制台上输入下一行:Install-Package SSH.NET -Pre

希望它有所帮助。