Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i cannot insert the 2 variables ssid and password in the argument string.
plz tell me how can i add those in that argumrnt string.

What I have tried:

C#
cmd.Arguments = " /c netsh wlan set hostednetwork ssid={ssid} key={pass}"; //doesnt work
cmd.Arguments = " /c netsh wlan set hostednetwork ssid={0} key={1}",ssid,pass; //doesnt work
Posted
Updated 12-Jul-18 22:58pm
v2

1 solution

Depends on the version of C# you use: from C#6 you can use
C#
cmd.Arguments = $" /c netsh wlan set hostednetwork ssid={ssid} key={pass}";
But before that either
C#
cmd.Arguments = " /c netsh wlan set hostednetwork ssid=" + ssid + " key=" + pass;
Or
C#
cmd.Arguments = string.Format(" /c netsh wlan set hostednetwork ssid={0} key={1}", ssid, pass);
will do it.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900