Add some new lan-int options

Quick options, such as restarting an interface
and releasing/renewing the interface IP address
This commit is contained in:
David Todd 2017-06-15 12:00:10 -05:00
parent ec2c17e905
commit 06fa2732c1

View File

@ -76,13 +76,13 @@ if '%errorlevel%' NEQ '0' (
:help
:: Make the window a little wider to fit the help text
mode con:cols=130 lines=30
mode con:cols=135 lines=32
title Quick Utility - Help
echo This script facilitates setting various networking features without having to go into the control panel
echo When pressing CTRL+C, you will be prompted if you wish to terminate the batch job. Answering Y will close this script.
echo Here is what the following options do and how to use them
echo.
echo ===============================================================================================================================
echo ===========================================================================================================================================
echo.
echo Main Menu Help
echo Quit - Exits the script, you can do this at anytime by pressing CTRL+C or by clicking the x in the upper right corner
@ -95,12 +95,14 @@ if '%errorlevel%' NEQ '0' (
echo Enable Network Adapter - Sets the "%wifiint%" network adapter to Enabled (reconnecting back to its previous network)
echo Show COM Ports - Lists the COM (serial) ports connected to this device
echo Ping Host - Prompts user for IP address of host and opens a new cmd window to ping until canceled by the user with CTRL+C
echo Restart "%lanint%" - Disables and Re-Enables your "%lanint%". Same as using option 3 twice, except for "%lanint%" instead of "%wifiint%"
echo Release and Renew "%lanint%" - If DHCP is turned on, it will release its IP address and request a new one
echo.
echo ===============================================================================================================================
echo ===========================================================================================================================================
echo.
echo Advanced Options - These are settings that change how this script acts without having to edit it
echo Change name of %lanint% - This changes the network interface that this script will set network settings for
echo Change name of %wifiint% - This changes the wireless network interface that this script will enable/disable
echo Change name of %wifiint% - This changes the network interface that this script will enable/disable
echo Change flag StatInt for %lanint% - By default, the script assumes that "%lanint%" is in DHCP mode, toggle this to assume static IP
echo Change flag FWStatus - By default, the script assumes that the firewall is enabled, toggle this to assume disabled
echo Change flag IntOff - By default, the script assumes that "%wifiint%" is enabled, toggle this to assume disabled
@ -140,6 +142,8 @@ if '%errorlevel%' NEQ '0' (
:: Single use actions
echo [7] Show COM Ports
echo [8] Ping Host
echo [9] Restart "%lanint%"
echo [0] Release and Renew "%lanint%"
echo.
:: Process the user input from the menu
@ -173,6 +177,8 @@ if '%errorlevel%' NEQ '0' (
:: Single use actions
for %%? in (7) do if /I "%C%"=="%%?" goto G
for %%? in (8) do if /I "%C%"=="%%?" goto H
for %%? in (9) do if /I "%C%"=="%%?" goto I
for %%? in (0) do if /I "%C%"=="%%?" goto J
for %%? in (A) do if /I "%C%"=="%%?" goto advmenu
for %%? in (Q) do if /I "%C%"=="%%?" goto end
for %%? in (H) do if /I "%C%"=="%%?" goto help
@ -450,4 +456,34 @@ if '%errorlevel%' NEQ '0' (
cls
goto choice
:: Restart %lanint%
:I
:: Disables/Enables the interface defined as %lanint%
title Quick Utility - Restart Network Adapter: %lanint%
echo Disabling %lanint%
netsh interface set interface "%lanint%" Disable
echo Enabling %lanint%
netsh interface set interface "%lanint%" Enable
pause
cls
goto choice
:: Release and Renew %lanint%
:J
title Quick Utility - Release and Renew DHCP: %lanint%
echo Releasing the IP address on %lanint%
ipconfig /release %lanint% > NUL
echo Requesting new IP address on %lanint%
ipconfig /renew %lanint% > NUL
echo Here are the new settings for %computername%:
netsh int ip show config name="%lanint%"
pause
cls
goto choice
:end