1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

.bat .cmd code help

Discussion in 'General Programming Chat' started by PigFish, May 25, 2012.

  1. PigFish

    PigFish Junior Member

    Joined:
    Apr 5, 2012
    Messages:
    124
    Likes Received:
    31
    Hi,

    I am after a little advice..I basically have a bat file that i have been running for the past hour with no issues.
    But for some reason all of a sudden it will load up the url, then do one of 2 things

    It will either stay on the page and not do anything, or open - stay on it for a few seconds - close and then not re open the page.
    What i can understand is how it was working fine for over an hour and now is not, does anyone know if it is something to do with my pc or with the code itsself?

    Code:
    @echo off:
     
    loop
    Start firefox http://nullrefer.com/?http://www.websitenamehere.com
    ping -n 10 127.0.0.0>nu1
    taskkill /f /im firefox.exe
    ping -n 5 127.0.0.0>nu1
    goto loop
     
  2. ionutcib

    ionutcib Junior Member

    Joined:
    Feb 10, 2011
    Messages:
    116
    Likes Received:
    8
    Occupation:
    Java Programmer
    Maybe the firefox process was not ended properly with taskkill...try to put a pause before taskkill , this way you will be sure that firefox start command was fully processed.
     
  3. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,147
    He has a a pause, that 's what the ping is there for ;)
     
  4. ionutcib

    ionutcib Junior Member

    Joined:
    Feb 10, 2011
    Messages:
    116
    Likes Received:
    8
    Occupation:
    Java Programmer
    ...then maybe the pause is not big enough. :)
    You can check from Task Manager if the Firefox process is ended at the right time.