Could someone help me write a simple bat file

Discussion in 'Community Discussion' started by brunetmj, Sep 2, 2010.

  1. brunetmj macrumors member

    Joined:
    Jul 9, 2010
    Location:
    Upstate, NY
    #1
    I tried researching bat files but it got to complex for me

    From my Windows XP desktop I want to be able to execute a bat file to open mytextfile.txt (located in the root directory) in notepad , keep it open for five minutes, close notepad and open the same text again 5 minutes later , indefinitely (until I stop the bat file manually)
     
  2. iShater macrumors 604

    iShater

    Joined:
    Aug 13, 2002
    Location:
    Chicagoland
    #2
    The problem is going to be the closing of that file. You can have the batch file open notepad, but doing a close on it is not something native to DOS/CMD shell.

    What is that you are trying to accomplish by doing all this? why do you need that file opened at those intervals? Maybe a batch file is not the best solution.

    And by the way, the title is misleading, this is not a simple bat file ;)
     
  3. chrmjenkins macrumors 603

    chrmjenkins

    Joined:
    Oct 29, 2007
    Location:
    CA
    #3
    Honestly, it sounds like a prank to me.
     
  4. brunetmj thread starter macrumors member

    Joined:
    Jul 9, 2010
    Location:
    Upstate, NY
    #4
    This is not any kind of prank.
    If you send me an email here I would be happy to explain in full.

    Sorry if the title was misleading. Since i am a novice concering bat files I just assumed people with advanced computer skills might find it a relatively easy task.
    I am simply trying to open and close a file at regular intervals. It could be an excel file or access or any other. Again this is a real need for a good reason.
    I should have said open and close any kind of file automatically repeatedly
     
  5. SilentPanda Moderator emeritus

    SilentPanda

    Joined:
    Oct 8, 2002
    Location:
    The Bamboo Forest
    #5
  6. chrmjenkins macrumors 603

    chrmjenkins

    Joined:
    Oct 29, 2007
    Location:
    CA
    #6
    I was not passing judgment. Pranks can be funny. I was simply stating that seemed like the most obvious use.
     
  7. brunetmj thread starter macrumors member

    Joined:
    Jul 9, 2010
    Location:
    Upstate, NY
    #7
    I took no offense to the prank statement
    Since people are curious by nature and have good reasons to ask questions when trying to help someone I originally intended to post my reasons.I just thought at the last moment that it may not be a good idea. Again would be happy to explain in email
     
  8. iShater macrumors 604

    iShater

    Joined:
    Aug 13, 2002
    Location:
    Chicagoland
    #8
    The plot thickens! :p


    But an automation scripting tool would be better than bat. The closing part would not work.
     
  9. renewed macrumors 68040

    renewed

    Joined:
    Mar 24, 2009
    Location:
    Bemalte Blumen duften nicht.
    #9
    Now I want to know what the purpose of this is!
     
  10. brunetmj thread starter macrumors member

    Joined:
    Jul 9, 2010
    Location:
    Upstate, NY
    #10
    I would not be able to use third party software- only programs that typically comes with windows in a business environment.
    This is not much of a plot. It just involves some knowledge of how companies work things these days with their computers combined with the fact I made the unfortunate choice of using most of my real name on this forum
     
  11. iShater macrumors 604

    iShater

    Joined:
    Aug 13, 2002
    Location:
    Chicagoland
    #11
    Then my recommendation is to stop doing whatever it is you are doing at work. Not worth the risk. Having a script do something will be seen by someone that you trying to pull a fast one, whether pretending that windows are opening, that something is getting done, cleaning something up, etc.

    My honest recommendation from a fellow corporate drone. :eek:

    Besides, cannot be done in .bat, you need an application/tool to do what you are asking for it to do.
     
  12. brunetmj thread starter macrumors member

    Joined:
    Jul 9, 2010
    Location:
    Upstate, NY
    #12
    After considering what you said i will heed your advice.
    However this does not rule out mechanical interventions.
    Does anyone know where I can get a vibrating mouse?;)

    Just to clarify IT schemes to save money sometimes don't work well with how things get done in the real world. The fact is they are making multitasking almost impossible.
     
  13. SilentPanda Moderator emeritus

    SilentPanda

    Joined:
    Oct 8, 2002
    Location:
    The Bamboo Forest
  14. robvas macrumors 68020

    Joined:
    Mar 29, 2009
    Location:
    USA
    #14
    You'd want to use Task Scheduler, this isn't 1994.

    Actually, you'd want to use PowerShell, this isn't 1999.
     
  15. brunetmj thread starter macrumors member

    Joined:
    Jul 9, 2010
    Location:
    Upstate, NY
    #15
    That's a very neat device. Unfortunatly IT strikes again.Any thing that you would put in your home computer gets encrypted before you can use it on my work computer.
    It would wipe it clean. The hard drives and any cd's are also encrypted.
    I was considering inventing a motorized pile driver
    Put it next to the keyboard and a mechanical finger pushes a key and then raises at timed intervals :)
     
  16. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #16
    You need to use vbscript to start and possibly kill notepad. To be honest even then, I'm not sure its possible.

    I've written my share of vbscripts and batch files and I can easily say that batch files can only do the most basic tasks. vbscripts give you more power and flexibility but the system shields you from doing some things.
     
  17. brunetmj thread starter macrumors member

    Joined:
    Jul 9, 2010
    Location:
    Upstate, NY
    #17
    Thanks everyone. It may be easier to do something mechanical such as keep the mouse in motion and maybe less detectable by big brother.
     
  18. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #18
    If the intent of the script is to fool some monitoring software, I'm not sure a running script that starts/stops an application will do that.

    some (most?) of those type of programs monitor keyboard (and possibly mouse) activity to see if the computer is being actively used, not whether an app is starting or stopping.
     

Share This Page