how to give commands to the cmd through a windows 8 app in c# for wifi hotspot -
we planning develop wifi hotspot app in windows appstore using xaml , c# in visual studio. unable find class or methods access command prompt desktop. need type below code start hotspot connection using internet sharing in windows 8: netsh wlan set hostednetwork mode=allow ssid=connectionname key=8characters need have solution problem somehow through can send above commands command prompt , start connection using windows 8 app. please me. thank you.
use system.diagnostics.process execute commands.
sample code, copied verbatim documentation, modified needs:
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; // can start process, helloworld 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(); // code assumes process starting terminate itself. // given is started without window cannot terminate // on desktop, must terminate or can programmatically // application using kill method. } catch (exception e) { console.writeline(e.message); } } } }
Comments
Post a Comment