Batch File Help

Discussion in 'Windows Operating Systems' started by aussie-revhead, Mar 2, 2021.

  1. aussie-revhead

    aussie-revhead Member

    Joined:
    Feb 21, 2005
    Messages:
    19,766
    Location:
    St Clair 2759
    Guys, I am working with an issue with a mining app closing itself while in use so I found a batch file to restart the app if it closes:

    So I am testing this now but I want to generate a simple log file to tell me when it restarted, so I can see how often it does this and how long between. Will this work:

    Do I have to echo off before goto start?
    Do I need to create the log file with set filename or set path? Or just create it in the same folder?

    Any help would be great.

    :)
     
    SayitaintSo likes this.
  2. NSanity

    NSanity Member

    Joined:
    Mar 11, 2002
    Messages:
    18,284
    Location:
    Canberra
    make it a service imo - that way you can have windows manage/monitor it and restart if/where possible.

    Having a looping batch file that never stops is not very elegant.
     
    qwertylesh likes this.
  3. Myne_h

    Myne_h Member

    Joined:
    Feb 27, 2002
    Messages:
    11,322
    As you wrote it should work fine. It'll create in the same folder. It's inelegant, but meh.
     
  4. OP
    OP
    aussie-revhead

    aussie-revhead Member

    Joined:
    Feb 21, 2005
    Messages:
    19,766
    Location:
    St Clair 2759
    I know zero about this subject

    It cant stop because it has to jump start the exe indefinitely

    The original is most inelegant, at least mine outputs a log file :)

    Im open to ideas, what would make it elegant?

    :)
     
  5. Myne_h

    Myne_h Member

    Joined:
    Feb 27, 2002
    Messages:
    11,322
    Elegance would be creating a service.

    But frankly, it will do exactly the same thing and require 10x more work to figure out all the parameters correctly for 'sc create' or schtasks, and test it all.

    Honestly, I'd leave it as it is, drag it into the user's startup folder, and set an autologon.

    10 mins job done.
     
  6. qwertylesh

    qwertylesh Member

    Joined:
    Aug 21, 2007
    Messages:
    8,925
    You could get fancy with variables and also make it self elevating, trial and error for any of the basic stuff that isn't working right would do it
     

Share This Page

Advertisement: