Batch processing of shared network connection to WLAN under Win7

  
Copy the following code into Notepad, select Save As, and select the file type as All Files. The file name is named suffix bat (***.bat).
You must be running as an administrator!
How to turn on network sharing:

Try not to change ip:

Code section:
@echo off
:head
cls
echo.
echo ---------------------------------- ---------------------------------------------
echo only Win7 is available, please run as administrator, do not run as administrator, please quit and run as administrator
echo --by HKKKYY
echo -------------- -------------------------------------------------- ---------------
echo Please select A, B, C, D, W:
choice /n /c ABCDW /m "A.Configure the wireless router, B reads the wireless routing configuration, C. Open the wireless router, D. Exit the program, W. Help information "
if errorlevel 5 goto help
if errorlevel 4 goto exit
if errorlevel 3 goto start
if errorlevel 2 goto load
if errorlevel 1 goto creat
:error
echo.
echo There is no configuration information or configuration error, please reconfigure the router
:help
echo.
echo help information!
echo open internet sharing:
echo.
echo 1.Open the web And sharing center
echo 2. Change adapter settings on the left
echo 3. Right click on the network adapter connected to the internet
echo 4. Select Properties
echo 5. Select the rightmost share< Br>echo 6. Allow other network users to tick the connection
echo 7. Select the wireless network connection* (Microsoft Virtual WiFi Miniport Adapter)
echo 8. Confirm all the way, the setup is complete!
echo.
Echo More questions, please send to email: [email protected]
pause
goto head
:creat
echo ----------------- ----------------------------
set /p ssid=Please enter the wireless network name and press Enter to return:
Set /p key=Please enter the wireless network password, press Enter to end (password is 8 or more digits or letters):
echo %ssid%.%key% >wlan.inf
goto load< Br>:load
if not exist wlan.inf goto error
for /f "delims=. tokens=1-2" %%a in (wlan.inf) do set ssid=%%a & Set key=%%b
netsh wlan set hostednetwork allow %ssid% %key%
if not errorlevel 0 goto error
echo Route configuration is successful, is the wireless routing function enabled? /N)
choice /n /c YN /m ":"
if errorlevel 2 goto head
if errorlevel 1 goto start
:start
netsh wlan start hostednetwork
If errorlevel 1 echo Please reconfigure the route and check if your computer has a virtual wireless network card
if errorlevel 0 goto now
goto head
:now
cls
echo.
echo wireless Route Open is turned on. . .
echo.
echo ----------------------------------------- ----------------
echo ssid is %ssid%, password is %key%
echo --by HKKKYY
echo ------- --------------------------------------------------
echo.
choice /n /c TSX /m "Please turn off the wireless routing function, press T, set the timed shutdown, press S, press the network connection test, press X"
if errorlevel 3 goto test
if errorlevel 2 goto shutdown
if errorlevel 1 goto stop
:stop
netsh wlan stop hostednetwork
goto head
:shutdown
set /p time=Please enter the duration of the automatic shutdown If you shut down after one hour, enter 3600, cancel the automatic shutdown, please enter 0:
if %time% equ 0 shutdown /a & goto now
shutdown /s /t %time%
if errorlevel 1 echo The setting failed, please confirm the input is correct, or cancel the previous settings & pause & goto now
if errorlevel 0 echo %time% seconds after shutdown & pause & goto now
:test
cls
@ping 218.85.157.99
set /a ping2=%errorlevel%
@ping 192.168.137.1
set /a ping1=%errorlevel%
if %pi Ng2% neq 0 echo Your computer is currently unable to connect to internet & pause & goto now
if %ping1% neq 0 echo Please share your current network connection to Microsoft Virtual WiFi network adapter & pause & goto Now
echo.
echo ---------------------------------------- ------------------------------
echo The network connection is normal. If you are still unable to connect to the network, please send the question to E-mail: [email protected]
echo --------------------------------------- -------------------------------
pause
goto now
:exit

Copyright © Windows knowledge All Rights Reserved