如何通过c#for wifi热点中的windows 8应用程序向cmd发出命令

如何通过c#for wifi热点中的windows 8应用程序向cmd发出命令,c#,windows-8,cmd,C#,Windows 8,Cmd,我们计划在windows appstore中使用VisualStudio中的XAML和C#开发wifi热点应用程序。我们无法找到任何类或方法从桌面访问命令提示符。我们需要键入以下代码才能在windows 8中使用internet共享启动热点连接: netsh wlan设置hostednetwork模式=允许 ssid=ConnectionName键=8个字符 我们需要以某种方式解决这个问题,通过它我们可以将上述命令发送到命令提示符,并使用Windows8应用程序启动连接。 请帮帮我。 谢谢。用于

我们计划在windows appstore中使用VisualStudio中的XAML和C#开发wifi热点应用程序。我们无法找到任何类或方法从桌面访问命令提示符。我们需要键入以下代码才能在windows 8中使用internet共享启动热点连接: netsh wlan设置hostednetwork模式=允许 ssid=ConnectionName键=8个字符 我们需要以某种方式解决这个问题,通过它我们可以将上述命令发送到命令提示符,并使用Windows8应用程序启动连接。 请帮帮我。 谢谢。

用于执行命令

从文档中几乎一字不差地复制的示例代码,根据您的需要进行了修改:

using System;
using System.Diagnostics;
using System.ComponentModel;

namespace MyProcessSample
{
    class MyProcess
    {
        public static void Main()
        {
            Process myProcess = new Process();

            try
            {
                myProcess.StartInfo.UseShellExecute = false;
                // You can start any process, HelloWorld is a do-nothing example.
                myProcess.StartInfo.FileName = "%Windir%\System32\netsh.exe";
                myProcess.StartInfo.CreateNoWindow = true;
                myProcess.StartInfo.Arguments = "wlan set hostednetwork mode=allow ssid=ConnectionName key=8Characters ";
                myProcess.Start();
                // This code assumes the process you are starting will terminate itself.  
                // Given that is is started without a window so you cannot terminate it  
                // on the desktop, it must terminate itself or you can do it programmatically 
                // from this application using the Kill method.
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}

您可以创建一个批处理文件,并让程序在启动时运行该文件

有什么事吗

netsh wlan set hostednetwork mode=allow ssid=ConnectionName key=8Characters 

欢迎来到StackOverflow!因此提出的问题应显示先前研究的证据以及为找到解决方案所作的合理努力。请看