1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

How make batch job window close

Discussion in 'Legacy Windows' started by rlambert7, 2004/03/27.

Thread Status:
Not open for further replies.
  1. 2004/03/27
    rlambert7

    rlambert7 Inactive Thread Starter

    Joined:
    2003/09/10
    Messages:
    199
    Likes Received:
    0
    I wrote a short .BAT file that I wanted to have run via the Windows Scheduler. First time I ran it the DOS (or COMMAND) window appeared, and in the top of the window it said, "Finished ".

    I'm almost certain that, in the past, I've been able to write .BAT scripts that were run by the scheduler that "disappeared" after they completed.

    I looked at the properties of the .BAT file, and, under the Program tab, I noticed a box called "Close on exit ", that was not checked. I thought, "Ah, hah! ", and checked it, but the DOS/COMMAND window still hangs around after the scheduled job completes, and I have to close it myself.

    Hmm, maybe the "close" in the "close on exit" does not mean "close ", as in "close the door ", but "close" as in "close, but no cigar. :)

    I also noticed that after having checked the "Close on exit" box that a new, .PIF, file, that pointed to the .BAT file, was created. So, I thought perhaps I needed to use the .PIF file as the file I would schedule instead of the .BAT file. I tried that, but the icon that gets put in the Scheduler window after I create the job looks like the .BAT file icon, and not the .PIF file icon.

    Anyway, how do I get the batch job window to go away all by itself once it has completed?

    Thank you.

    -Richard
     
  2. 2004/03/27
    Welshjim

    Welshjim Inactive

    Joined:
    2002/01/07
    Messages:
    5,643
    Likes Received:
    0
    Tab down a line from the present end of the .bat file and type cls, then click File| Save
     

  3. to hide this advert.

  4. 2004/03/27
    rlambert7

    rlambert7 Inactive Thread Starter

    Joined:
    2003/09/10
    Messages:
    199
    Likes Received:
    0
    Thanks. I tried that, but I still have the window when the job finishes. I looked up "dos cls command" in a search engine, and it said that "cls" clears the window, and leaves only a prompt. That seemed to be the case when I used it.

    -Richard
     
  5. 2004/03/27
    markp62

    markp62 Geek Member Alumni

    Joined:
    2002/05/01
    Messages:
    4,012
    Likes Received:
    16
    Add this as the final command.
    exit
     
  6. 2004/03/28
    rlambert7

    rlambert7 Inactive Thread Starter

    Joined:
    2003/09/10
    Messages:
    199
    Likes Received:
    0
    Alas, I had already tried that. Window still hangs around with, or without, the "exit ", with or without the "cls ", and with or without the two of them. :(

    ...wrestle, wrestle, wrestle...

    OK, I think I've got it. I had mentioned that when I checked the "close on exit" box, under the "Program" tab under "Properties" of the .BAT file, another file was greated, a .PIF file. However, if I selected the .PIF file via the scheduler, the original .BAT file was placed in the schedule, not the .PIF file. Windows knows best, right? So, I tried directly double-clicking on the .BAT file to run it. When I did that, it ran, but the window remained. Next, I directly double-clicked on the .PIF file. It ran, and the window disappered when it is finished. Hmm, interesting.

    So, I went back to the scheduler, and selected "properties" for the job in question. In the "Run:" box I replaced the name of the .bat file with the .pif file, and ta-da! But SHEESH!
     
  7. 2004/03/28
    merlin

    merlin Inactive

    Joined:
    2003/01/07
    Messages:
    1,111
    Likes Received:
    0
    Do not run the .bat file but the .pif file that is automatically
    created to run it - same as a shortcut.
    Right click the .pif file to select what behaviour you want -
    minimised, close on Exit and so on.
    regards
     
  8. 2004/03/28
    jubalsams

    jubalsams Inactive

    Joined:
    2003/11/07
    Messages:
    83
    Likes Received:
    0
    I find that they close when i don't want them to close so i have to put a PAUSE at the end of the .bat calling with a pif. Maddening !
    OOPS: i'm talking about the bats in NT class. Confusing. i try running the same bats in 9x and NT and they act different.
     
    Last edited: 2004/03/28
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.