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

    • Patch My PC - Home Updater 5.2.3.0 by Razvan Serea Patch My PC Free is a reliable tool which can quickly check your PC for outdated software. The supported third-party programs include a large number of widely-used applications, including Adobe Reader, Mozilla Firefox, Java, 7-Zip, BleachBit, Google Chrome and many more. Patch My PC Home updater features: Updates over 500 common apps check including portable apps Ability to cache updates for use on multiple machines No bloatware during installations Applications install/update silently by default no install wizard needed Optionally, disable silent install to perform a manual custom install Easy to use user interface Change updated and outdated apps color for color blindness Option to automatically kill programs before updating it Create a baseline of applications if installing on new PC’s Quickly uninstall multiple programs Scan time is usually less than 1 second Set updates to happen on a schedule Skip updates for any application you don’t want to update Suppresses restarts when performing application updates Patch My PC - Home Updater 5.2.3.0 changelog: Startup Manager New tab to manage which apps launch at startup. This helps speed up your boot time and gives you control over what runs in the background. Generate Diagnostic ZIP You can now create a diagnostic ZIP file from the About page. This helps if you need to send logs on our support forum for Home Updater. Remove Portable Apps Right-click any portable app in the App Catalog or Uninstaller page to remove it directly. Applications Added FFmpeg (Full Shared) – Portable Fing G-Helper – Portable IntelliJ IDEA Community Edition K-Lite Basic Codec Pack K-Lite Full Codec Pack K-Lite Standard Codec Pack KeePass Password Safe v1 LibreOffice Help Pack MemTest86 – Portable Nexus Vortex Nvidia Profile Inspector – Portable Pale Moon – Portable ViVeTool – Portable WinCDEmu Windows PC Health Check Wise Video Converter Applications Removed Driver Easy Download: Patch My PC 5.2.3.0 | 54.8 MB (Freeware) Download: Patch My PC Portable | 31.0 MB (Portable) View: Patch My PC Free Homepage | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • "For starters, Microsoft Edge is getting a media control center. This feature is intended to let you control multiple media sources from any website in a single place." Oh, I've got this Media Control and couldn't find how to disable it. I hate it when a button appears on a toolbar where there was none just before I press Play. I probably would find it at least somewhat useful if I could start playing media from any opened tab, but now it only shows controls for media I've already started playing. If anyone knows how to disable it - I'd appreciate a hint.
    • Now that he turned on Trump and both sides hate him does anyone want this stupid thing?
    • This is what I thought of earlier today because it seems a bit stupid to have an iPhone 17 running iOS 26 (or iOS 2026 / or even iOS 25/2025). Just make it simple so that the year of the hardware release and the software release are in sync. I personally think they should go with 25 or 2025 (not 26 or 2026), but syncing the hardware and software version numbers could be easier to keep track of. At first, it will maybe be jarring due to all of the changes across the ecosystem, but from that point on it will be easier to keep track of.
    • my dad is experiencing the same thing except it's with Excel. the font became thin compared to windows 10, all the settings the same. i've chalked it up to it being that its connected via DVI instead of HDMI. is your setup the same? i have no technical reasons to believe it's DVI, just a plain guess since the other screen he's connected to seems better to me although may just be my mind playing tricks.  also, why don't you change the text size in accessibility? maybe this will help?   
  • Recent Achievements

    • Week One Done
      abortretryfail earned a badge
      Week One Done
    • First Post
      Mr bot earned a badge
      First Post
    • First Post
      Bkl211 earned a badge
      First Post
    • One Year In
      Mido gaber earned a badge
      One Year In
    • One Year In
      Vladimir Migunov earned a badge
      One Year In
  • Popular Contributors

    1. 1
      +primortal
      492
    2. 2
      +FloatingFatMan
      256
    3. 3
      snowy owl
      248
    4. 4
      ATLien_0
      224
    5. 5
      +Edouard
      189
  • Tell a friend

    Love Neowin? Tell a friend!