Recursive .Bat file error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cnixuser
    New Member
    • Dec 2006
    • 80

    Recursive .Bat file error

    hi, I'm trying to get a bat file together that pings every 5 minutes, and will reboot the pc if a ping is not found, I get an error:

    "The process cannot access the file because it is being used by another process.",

    when I try to run this bat file called "ping.bat":

    Code:
    @echo off
    ping -n 1 -w 300000 www.google.com | find "could not find host" > null && call shutdown -r -t 0 -f
    call ping.bat
    any assistance will be greatly appreciated
  • Stang02GT
    Recognized Expert Top Contributor
    • Jun 2007
    • 1206

    #2
    well since you are making a call to that bat file in this bat file, why would you need to run it separately?

    Or am I misunderstandin g?

    Comment

    • jg007
      Contributor
      • Mar 2008
      • 283

      #3
      Originally posted by cnixuser
      hi, I'm trying to get a bat file together that pings every 5 minutes, and will reboot the pc if a ping is not found, I get an error:


      Code:
      @echo off
      ping -n 1 -w 300000 www.google.com | find "could not find host" > null && call shutdown -r -t 0 -f
      call ping.bat
      any assistance will be greatly appreciated
      why not just use goto?


      Code:
      @echo off
      :start
      ping -n 1 -w 300000 www.google.com | find "could not find host" > null && call shutdown -r -t 0 -f
      goto start

      Comment

      • jg007
        Contributor
        • Mar 2008
        • 283

        #4
        also you might want to look at vbscript as it is pretty easy and gives you more control

        Last edited by Nepomuk; Sep 3 '08, 02:02 PM. Reason: Please use the URL tags

        Comment

        • Stang02GT
          Recognized Expert Top Contributor
          • Jun 2007
          • 1206

          #5
          Originally posted by jg007
          also you might want to look at vbscript as it is pretty easy and gives you more control

          http://www.robvanderwo ude.com/vbstech_network _ping.html
          Hey jg007,

          I don't have MOD rights in this forum to change it but are you aware that you can actually insert a hyperlink into your posts?

          Next time you go to post a link there is a picture of a planet(earth) at the top of the post box. If you use that it will set you through inserting a useable hyper link.

          Just a note so that people don't have to copy and paste the url.

          Comment

          • Nepomuk
            Recognized Expert Specialist
            • Aug 2007
            • 3111

            #6
            Originally posted by Stang02GT
            I don't have MOD rights in this forum to change it but are you aware that you can actually insert a hyperlink into your posts?
            Well, I do. ^^ So, I've added the URL tags. As Stang02GT said, please use them.

            Greetings,
            Nepomuk

            Comment

            • Stang02GT
              Recognized Expert Top Contributor
              • Jun 2007
              • 1206

              #7
              Originally posted by Nepomuk
              Well, I do. ^^ So, I've added the URL tags. As Stang02GT said, please use them.

              Greetings,
              Nepomuk
              Thank you Nepomuk!!!!!!!

              Comment

              Working...