Professional Documents
Culture Documents
/2011
Shivaranjan.com
Tech New s
Home About & Disclosure Privacy Policy Contact Me Home > Tutorial, Windows > Windows Settings Quick Tip: How to Create a Batch File for Changing Network
Windows Quick Tip: How to Create a Batch File for Changing Network Settings
by Shivaranjan on July 15, 2007
ADVERTISEMENTS
Batch/BAT Files Made Easy www.NetworkAutomatio Drag-&-Drop Batch/BAT Automation. Free 30 day trial. Download Now! Top 10 Keyloggers of 2011 WellResearchedReviews. Side by side comparison of the best keylogger programs available! File Configuration www.ncircle.com/FileIntegrity Get Comprehensive Agentless File Integrity Solution - Free Guide. Desktop Administration ManageEngine.com/Desktop Install MSI/EXE, Remote Control, Patch & Asset Management. Download!
The aim of this tutorial is to create a batch file using which you will be able to change your network settings with just a click of your mouse. Why to create a batch file for changing network settings? If you happen to use a laptop at your workplace and at home the you may have to change the network settings when ever you move from home or office. The normal procedure where we usually open the network connections and enter the IP address manually is painful if we do it daily. To get this done easily all you have to do is create two batch files which will ease our task. How to create a batch file for changing network settings?
shivaranjan.com//windows-quick-tip-h 1/10
20/avr./2011
The relevant IPs are illustrated in the screenshot below, the IPs that are illustrated are only examples:
3. Now that you have copied the code, paste this in the Notepad. Enter the IPs as per your requirements and save the file with the extension *.bat [eminimall] 4. Your batch file is now ready for execution, now double click the batch file that you just created and you will find your network settings configured in a few seconds. 5. Create another batch file using the similar procedure, in this batch file you enter the IPs that are relevant to
shivaranjan.com//windows-quick-tip-h 2/10
20/avr./2011
6. Now you should be having two batch files one for your office network and the other for your home network . I guess by using this method your life would ease a bit. If you have better method then do let me know.
this article? Please subscribe to RSS Feed to receive all the updates!
Related Posts:
No related posts found { 17 comments read them below or add one }
Venu July 15, 2007 at 11:28 pm Cool, never knew of the netsh command. In fact I was just going over the MS documentation, there is an option of running the a pre-configured script as well. Accomplishes the same thing, but probably its more neat As of now I have no trouble using my laptop at work and home. The default setting of automatically getting the IP works with no issues.
shivaranjan.com//windows-quick-tip-h 3/10
20/avr./2011
ReviewSaurus July 16, 2007 at 1:58 am Indeed very nice tip. Im sure I would have used it however, the DHCP enabled wireless router just saved me from using this. But, many more will certainly find it useful
Tien July 18, 2007 at 7:35 am I use NetsetManworks great and allows multiple network profiles Free for personal use http://www.netsetman.com/
Ephemeriis July 18, 2007 at 5:02 pm Terrific! Im constantly connecting to brand new routers/printers/print servers/WAPs/whatever and setting them up Its always a pain to click your way through the TCP/IP settings again and again for each device. This will prove very handy.
Dwanna September 10, 2007 at 9:41 pm I have used this type of command for over a year at my current work site, however; I have just tried to used it in Vista to see if it is valid after an upgrade and I cannot seem to make it work, nor can I find anything saying Change this or this and it will work in Vista as well. Got any ideas? It is setting the Gateway and both DNS without a problem but will not set the Address nor the Mask.
Shivaranjan September 12, 2007 at 10:53 pm DwannaThis code is not currently working in Vista, I will try to fix this once I get some time, but XP users can use it
Symbian September 24, 2007 at 4:58 pm For complex cases you can use special application for changing your connectivity but if it is simply changing of IP address and mask you can use this bat file.
20/avr./2011
Create a Batch File for Changing Network Settings netsh interface ip set address name=Local Area Connection source=static addr=192.168.1.100 mask=255.255.255.0 netsh interface ip set address name=Local Area Connection gateway=192.168.1.1 gwmetric=0 netsh interface ip set dns name=Local Area Connection source=static addr=208.67.222.222 netsh interface ip add dns name = Local Area Connection addr =208.67.220.220 Its work im very thaxnfull toooo
Razzor May 19, 2008 at 11:18 pm VISTA UPDATE!!!!! FINALLY! I have worked out how to get it to work in vista!! @ECHO OFF set varip=65.88.48.77 set varsm=255.255.255.224 set vargw=65.88.48.65 set vardns1=66.78.202.254 set vardns2=66.78.210.254 REM ***** You dont need to change anything below this line! ****** ECHO Setting IP to static netsh int ipv4 set address name = Wireless Network Connection source = static address = %varip% mask = %varsm% ECHO Setting IP Address and Subnet Mask netsh int ipv4 set address name = Wireless Network Connection address = %varip% mask = %varsm% gateway = %vargw% gwmetric = 1 ECHO Setting Primary DNS netsh int ip set dns name = Wireless Network Connection source = static addr = %vardns1% ECHO Setting Secondary DNS netsh int ip add dns name = Wireless Network Connection addr = %vardns2% ECHO Here are the new settings for %computername%: netsh int ip show config pause The change is quite simplethe problem seems to lie in vistas inability to set the ip to static, and assign the ip address at the same time. So all you have to do is set up the ip to static first, then set the ipvery
shivaranjan.com//windows-quick-tip-h 5/10
20/avr./2011
strange Note that your static ip is not displayed when shown, however it is set. Just change your network settings at the top and dont forget to change Wireless Network Connection to the name of your connection
Razzor May 19, 2008 at 11:23 pm You need to copy everything from @ECHO OFF down to and including pause into a text file and give it a .bat extension
Bostjan November 23, 2008 at 6:57 am This is something Ive been looking for a long time Thanks for tip!!!
Vijeth December 28, 2008 at 6:12 pm HEy can any1 tell me how to disable/enable LAN using batch file??
John February 4, 2009 at 4:38 pm I have tried solution for Vista but i got below error after each line: The requested operation requires elevation. What could be the reason
Neil March 21, 2009 at 5:01 pm You need to right click the batch file and choose run as administrator
Mark April 25, 2009 at 2:49 pm @Vijeth, The following, at the top, has a utility called ToggleNIC.exe, which will do what you want. http://channel9.msdn.com/playground/Sandbox/154712/
shivaranjan.com//windows-quick-tip-h
6/10
20/avr./2011
Dave January 25, 2011 at 9:00 pm Thanks for scripts! Want also to share my small tip: I use tool called Dr.Batcher ( http://www.drbatcher.com ) to write batch files, I like it more than Notepad. Leave a Comment Name * E-mail * Website
Submit
Previous post: JVC to Introduce 8.5GB Double Layer DVD-RW Media in August 07 Next post: Review: Samsung SyncMaster 940BW 19 Widescreen LCD Monitor
Categories
Aerospace Automobiles Best of Blogosphere Chrome Computer Hardware Computers and Internet Firefox Gadgets General Linux Military
shivaranjan.com//windows-quick-tip-h 7/10
20/avr./2011
Mobile Phones My Life Nokia N97 Symbian S60 v5 Personal Review Science Security Softwares Space Technology Tutorial Windows Windows 7
Recent Posts
Windows 7: How to Remove Windows 7 SP1 Backup Files to Gain / Free up Disk Space Google Chrome Extension: Text Only Open / View webpages or links in text only mode Review: Nokia N900 Maemo 5 Powered Internet Tablet with Phone Batch Unpack / Extract Password Protected Archives (zip, rar & 7z) using ExtractItAll Manage Mapped and Shared or Network Drives / Folders in Windows using Share Manager Subscribe to RSS Follow on Twitter
To search, type and hit enter
shivaranjan.com//windows-quick-tip-h
8/10
20/avr./2011
Recent Comments
Jack on iPod: How to Convert MP3 files to iPod Audio Book format (m4b) Silencer on Windows 7: How to Restore Windows 7 Partition or Hard Disk Partitions from a System Image chetan on Numeric Digital 600VA Plus UPS Review chetan on Numeric Digital 600VA Plus UPS Review Utkarsh on Nokia N97/5800 S60v5 App: Create Archive & Extract, Compress, Decompress Rar/Zip Files using WinRaR
Tag Cloud
cpu excel files Firefox folder
graphics card
to installat ion
guide jpeg jpg Linux map network drive microsoft microsoft office microsoft outlook outlook 2007 outlook add-in outlook attachment pdf pdf file p ng files folders ubuntu virt ualizat ion vist a
software sync files folder ubuntu ubuntu ubuntu intrepid ibex ubuntu linux ubunt u linux inst allation
Archives
Select Month
Pages
About & Disclosure
shivaranjan.com//windows-quick-tip-h 9/10
20/avr./2011
shivaranjan.com//windows-quick-tip-h
10/10