When you are on a business trip, you often need to modify the IP address information to access the Internet. However, after the organization, you need to change the original IP address back. This is inconvenient. So I wrote the following script to share it with you. In addition, please kindly advise:
The script is not complete yet: 1. Whether the file selector effect can be implemented in the script when the IP information is exported. The User specifies the storage path, and the user selects the path during the import.
2. Can I determine whether the export has been exported before, and then whether the user can continue to export the data? If yes, export the data again; otherwise, the script is terminated.
The script code is posted below. At the same time, we hope you can give me some advice on the above two questions. Thank you!
Script for exporting IP information:
@ Echo off
CLS
Echo.
Echo this script will automatically extract the IP address related to the local machine and save it to your disk.
Echo.
Echo ======================= author of The Script: nange! @ Version 2010/09/02 ========================
Echo.
ECHO is extracting the local IP address...
Netsh-C interface dump> D:/ipinfobackup.txt
Echo.
If exist D:/ipinfobackup.txt (
Echo IP address and other information exported successfully! For details, see D:/ipinfobackup.txt.
) Else echo IP extraction failed! Please try again later...
Echo.
Echo ================================= script execution is complete! Please follow any Jian end ===========================
Echo.
Pause
@ Echo on
Script for importing IP information:
@ Echo off
CLS
Echo.
Echo this script imports the specified IP address information to help you efficiently set the IP address and other related information.
Echo.
Echo ======================= author of The Script: nange! @ Version 2010/09/02 ========================
Echo.
ECHO is importing IP address information...
ECHO is setting IP address information. Please wait...
If exist D:/ipinfobackup.txt (
Netsh exec D:/ipinfobackup.txt
Echo IP address and other related information have been imported successfully.
The IP address specified by else ECHO does not exist. Run "export local IP. Bat" first "! Try again...
Echo.
Echo ================================= script execution is complete! Please follow any Jian end ===========================
Echo.
Pause
@ Echo on