Infinite loop in .bat file


Recommended Posts

I have to make a batch file for Windows XP to set the IPv6 address and default route for an ethernet card. This batch file should be loaded at every startup.

It looks like this:

ipv6 rtu 2002::/16 4
ipv6 adu 4/3ffe:bc0:174:1::2
ipv6 rtu ::/0 4/3ffe:bc0:174:1::1 pub life 1800

The problem is that when the batch file containing these lines is executed, it just executes the first line infinitly and I have to click the X to close it. I can manually type them in without any loops or problems.

Is there just a problem with my batch file? Are there any IPv6 pimpz :cool: who know that it isn't the batch file, rather just the first line?

Thanks for the help.

Link to comment
https://www.neowin.net/forum/topic/93787-infinite-loop-in-bat-file/
Share on other sites

It is supposed to route all IPv6 addresses in the 2002::/16 prefix to network interface 4. It is just a part of the process of setting up IPv6 on Windows XP. rtu is a supported ipv6 switch and it does what it is supposed to do when I type it into the command prompt manually. It is just with the batch file that I have problems. Go figure, I can make UNIX sh or bash scripts, but I can't do a simple DOS batch script. :blush:

"ipv6 install" just lets you use IPv6. You still have to configure the IPs and those IPs get erased every time you reboot, so you have to use a script to reset it, much like all networking in Linux. Right now I am using radvd on my Linux box to set the IPs on all the other boxes dynamically, but it sets a really long IP like: 3ffe:0bc0:0174:0001:0be1:112c:5c92:12ed and it gets on my nerves. I like the shorter 3ffe:bc0:174:1::2, which I have to set manually, but that is besides the point. My point is that my batch file is crappy so I need the smart people on Neowin to help me fix it. :) Do I need something like a semicolon at the end of everyline or maybe some command like STOP or EXIT or END at the end. Am I forgetting something at the beginning like START or BEGIN? (Or at least tell me its a bug so I can get on with my life...man I hate Windows.)

i'm gonna have to get used to these new IPs :wacko:

you don't need semicolons, STOP, EXIT, or END codes or anything (though you can use a cls at the end with no line return)

who knows, it may be a bug. the ipv6 standard isn't even finished yet is it? and i think microsoft's implementation of it is beta, included in xp only for developers. IMO they should have made it a separate download, but who am i to tell them what to do? ;)

if "ipv6" is a .com or .exe file it will execute and not return for further instruction. i think this is your problem. try using the call command to call the ipv6 program outside of the batch file. if you dont know how to use it google it up. :)

cheers and good luck.

p.s. a better solution, but more in depth, might be to create 4 batch files.

download the dos sleep application.

First bat file:

ipv6 rtu 2002::/16 4

exit

Second bat file:

sleep 15

ipv6 adu 4/3ffe:bc0:174:1::2

exit

Third bat file:

sleep 30

ipv6 rtu ::/0 4/3ffe:bc0:174:1::1 pub life 1800

exit

fourth bat file

call first.bat

call second.bat

call third.bat

exit

I used to be jl7c2 but changed my name. Sorry I have been very busy lately and haven't fooled around on my Windows XP :x computer. I just realized that my problem though. My file name was ipv6.bat. So when the line in the batch file called ipv6 rtu...it was calling ipv6.bat, which called it self again and again creating an infinite loop. Jeez I am so ebarassed that I didn't think about that. Now for more Windows bashing...<bash>UNIX sh scripts would never do that! Windows sucks!</bash> I'm only kidding. LOL.

Thanks for all your help though! :)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • It gave OEMs all kinds of stuff to put effort into that did nothing about bad drivers that crashed the system.
    • Yes, because Google's ad platform dominates the internet and most sites use Google's ad platform. Microsoft cares about their own ad platform. And they whitelist their ads. Edge is still on mv2 on desktop but they have officially announced they will stop supporting it. They haven't announced the date, but it is on their roadmap. Microsoft HAS the resources to keep it, but they have announced they will remove it unlike other chromium based browsers like Brave and Opera which have announced they will try to keep it. They postponing it in an attempt maybe to gain some market share from Chrome, but their end goal is the same, the deprecation of mv2. https://learn.microsoft.com/en-us/microsoft-edge/extensions-chromium/developer-guide/manifest-v3#manifest-timeline-for-microsoft-edge-and-partner-center
    • I'll say this again:  This hasn't changed since Windows 10.  This customization issue is not unique to Windows 11.   Windows 10 was released about 10 years ago.  I didn't look at changing default fonts in Windows 8 or 7.  Most (sane) people would look for supportability -- you might have the desired customization in those OSs but not able to play games, apps, that one typically gets the OS for.  No one is going to trade off getting an ancient OS just so they can have larger fonts but not be able to play games or run apps.   There are many options that are not exposed in the default UI because they have a lot more potential harm than benefit.  Doesn't mean they don't exist.  Hence, registry changes. "What's the harm by leaving it in Settings?"  Imagine if you changed the default font to something unreadable.  How would you change it back if you can't read anything?  The settings UI allows one to change size and style, but not font, so you'd still be able to read it.  Changing the font itself to Wingdings might render an OS unusable. Now YOU might be savvy enough to make that change and/or undo it, but that's why it's not exposed in simplistic UI and instead is moved to registry changes. Your 3rd party app is most likely causing conflict with the registry as it wants to make its own changes.  It's not voodoo magic here, that's typically what these apps do.  I'd bet you a beer if I spin up a new VM for Windows 11 and try my links above with no Winaero Tweaker it'd work just fine.  Introduction of 3rd party apps is always suspect -- who knows what else it's doing.  
    • Yes, and the reason is the defaults is has. The masses have no interest to change settings etc. It feels cluttered by default. The default home/NTP feels cluttered with so much stuff from MSN. The sidebar has too many buttons with Microsoft services. The default search engine is Bing. Just compare Edge defaults with Chrome defaults. The masses open Edge or are "forced" to open it, they don't like what they see and close it and go back to Chrome.
    • PrivaZer 4.0.106 by Razvan Serea PrivaZer is a PC cleaner that helps you master your security and freedom at home and at work. PrivaZer permanently and irretrievably erases unwanted traces of your past activity on your computer and on your storage devices (USB keys, external drive, and so on) which prevents others from retrieving what you have done, watched, streamed, visited on internet, freeing up valuable hard disk space, and keeping your PC running secure. PrivaZer key features: Deep Cleaning: PrivaZer thoroughly cleans your PC by removing unnecessary files, traces of activity, and potential privacy risks. Advanced Scan Modes: With multiple scan modes, including Quick and Deep scans, PrivaZer ensures comprehensive cleaning tailored to your needs. Customizable Cleaning: PrivaZer allows you to customize cleaning settings, so you can choose exactly what to clean and what to keep. Privacy Protection: PrivaZer safeguards your privacy by securely erasing traces of your online and offline activities, including browsing history and temporary files. Secure File Deletion: PrivaZer securely deletes sensitive files beyond recovery, ensuring your confidential data remains private. Startup Manager: PrivaZer helps you control which programs launch at startup, improving boot times and overall system performance. Automatic Updates: PrivaZer regularly updates its cleaning algorithms to adapt to new threats and ensure effective protection. Scheduled Cleanups: PrivaZer offers the convenience of scheduling automated cleanups, so your PC stays optimized without manual intervention. Portable Version: PrivaZer offers a portable version, allowing you to carry it on a USB drive and clean any PC without installation. Detailed Reports: PrivaZer provides detailed reports after each cleanup, giving you insights into the space reclaimed and the areas cleaned. File Shredder: PrivaZer includes a file shredder feature to securely delete files, making data recovery impossible even with specialized tools. Context Menu Integration: PrivaZer integrates with the context menu, enabling quick and easy access to cleaning functions from any file or folder. Multi-Language Support: PrivaZer supports multiple languages, making it accessible to users worldwide. Automatic Traces Detection: PrivaZer automatically detects traces of activity on your PC, ensuring thorough cleaning without manual intervention. System Restore Point Creation: PrivaZer creates system restore points before cleaning, allowing you to revert changes if needed. Disk Health Analysis: PrivaZer analyzes disk health and alerts you to potential issues, helping you prevent data loss and maintain system stability. Browser Extensions Cleanup: PrivaZer cleans up browser extensions and add-ons, improving browser performance and security. File Association Management: PrivaZer helps you manage file associations, ensuring files open with the correct programs for optimal usability. Intuitive User Interface: PrivaZer features an intuitive user interface, making it easy for both novice and advanced users to optimize their PCs for better performance and privacy. PrivaZer 4.0.106 changelog: New cleanup : BAM (Background Activity Monitor) Improved cleanup : Clipboard Improved UI Download: PrivaZer 4.0.106 | Portable PrivaZer ~30.0 MB (Freeware, paid upgrade available) View: PrivaZer Home Page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • Dedicated
      Epaminombas earned a badge
      Dedicated
    • Veteran
      Yonah went up a rank
      Veteran
    • First Post
      viraltui earned a badge
      First Post
    • Reacting Well
      viraltui earned a badge
      Reacting Well
    • Week One Done
      LunaFerret earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      481
    2. 2
      +FloatingFatMan
      264
    3. 3
      snowy owl
      232
    4. 4
      ATLien_0
      231
    5. 5
      Edouard
      172
  • Tell a friend

    Love Neowin? Tell a friend!