Batch processing of shared network connections to WLAN under WIN7

Source: Internet
Author: User
Tags exit echo 7 goto

Copy the following code to Notepad, select Save As, select the file type as all files, and name the file with a bat-suffix file (***.bat).

Must run as Administrator!

How to turn on network sharing:

Do not have to change IP to try:

Code section:

@echo off

: Head

Cls

Echo.

Echo-------------------------------------------------------------------------------

Echo only win7 available, run as Administrator, do not run as Administrator please exit again to 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 read no lines by configuration, c. Open the wireless router, D. Exit program, W. Help Info"

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 does not have configuration information or configuration errors, please reconfigure the router

: Help

Echo.

echo Help info!

echo Open Internet share:

Echo.

Echo 1. Open Network 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

Echo 6. Allow other network users to connect tick

Echo 7. Select Wireless network connection * (Microsoft Virtual WiFi miniport Adapter)

Echo 8. All the way to confirm, set complete!

Echo.

echo more questions, please send to email: 183229003@qq.com

Pause

Goto Head

: creat

Echo---------------------------------------------

set/p ssid= Please enter the wireless network name and press ENTER to end:

set/p key= Please enter the wireless network password and press ENTER to complete (8 digits or more digits or letters):

Echo%ssid%.%key% >wlan.inf

Goto load

: 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 routing configuration is successful, does it turn on without line functionality? (y/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 Routing and check that your computer has a virtual wireless network card

if errorlevel 0 goto now

Goto Head

: Now

Cls

Echo.

Echo has no line enabled by the Open feature ...

Echo.

Echo---------------------------------------------------------

The Echo SSID is%ssid% and the password is%key%

Echo--by Hkkkyy

Echo---------------------------------------------------------

Echo.

choice/n/C tsx/m "Turn off No Line by function please press T, set timer shutdown Please press S, network connectivity test please 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 automatic shutdown of the length of time, such as an hour after the shutdown, enter 3600, cancel automatic shutdown Please enter 0:

If%time% equ 0 shutdown/a & Goto Now

SHUTDOWN/S/T%time%

if errorlevel 1 echo setting fails, verify that the input is correct, or first cancel 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%ping2% NEQ 0 echo your computer is currently unable to connect to the Internet & Pause & Goto Now

If%ping1% NEQ 0 echo Please share your current network connection to the Microsoft Virtual WiFi network adapter & pause & Goto Now

Echo.

Echo----------------------------------------------------------------------

echo network connection is normal, if you are unable to connect to the network, please send the question to the mailbox: 183229003@qq.com

Echo----------------------------------------------------------------------

Pause

Goto now

: Exit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.