问题
When I want to start a local hotspot, I normally run cmd as administrator and type the command
netsh wlan start hostednetwork
. It wastes of time to run cmd and type this command. Is there any alternative way to do it using bat file?
回答1:
Might be late, but save only this line into .bat file:
netsh wlan start hostednetwork
And then use any .bat to .exe converter like this one: Advanced BAT to EXE Converter OR you can use anyone else you like.
Convert it, right click on the new one, Properties -> Compatibility -> Run this program as an administrator
Double click the new .exe file, and there you go!
You need to set the hostednetwork for the first time if you haven't before using this line:
netsh wlan set hostednetwork mode=allow ssid=SSID_NAME key=PASSWORD
IFF you want to run your hostednetwork at startup:
- Open Run (Windows key + R)
- type: shell:startup
- Then copy the .exe file you made previously in that folder.
You may need to enable "Run as an administrator" option for that program after moving it to startup folder.
回答2:
Take a look into this gist, in resume just write this into a batch-File
netsh wlan set hostednetwork mode=allow ssid=SSID_NAME key=PASSWORD
netsh wlan start hostednetwork
pause
回答3:
Me too, I don't want run command every create wifi, so I find a solution, that is create shortcut. It's easier than creating batch-file.
Start: netsh wlan start hostednetwork
Stop: netsh wlan stop hostednetwork
Right click shortcut / Properties / Advanced / Tick Run as administrator/ ok / Apply / ok.
You cant watch on youtube, this is tutorial video.
来源:https://stackoverflow.com/questions/28401704/start-hostednetwork-using-batch-file