Batch file behavior
Page 1 of 2 12 LastLast
Results 1 to 15 of 19

Thread: Batch file behavior

  1. #1
    Join Date
    Jun 2001
    Location
    Jacksonville,Fl,USA
    Posts
    341

    Batch file behavior

    I want to make sure that I understand this correctly.

    Suppose I make a batch file like so:

    @echo off
    defrag c: /F /SNE
    scandisk c: /AUTOFIX /SURFACE

    Is it the default behavior of a batch file to finish one command before it starts another?

    Thanks all, Dex

  2. #2
    Join Date
    Sep 2003
    Location
    Florida
    Posts
    1,494
    NO, I have all my game servers setup like that. I added 3 q3 servers in a batch file command and I have YET to come across a switch that makes it wait before one program is done. all a batch file does is run the program...it doesnt care about anything else...

    Anyone else know of a switch that will make the .bat file wait for one program to be done?
    .*TaNgZ*.

    **(Outdated)Power Machiene**
    **Tripple Boot System**
    Operating Systems
    : Windows 2000 SP4; Windows XP Pro; SuSE Linux 9.1
    CPU : AMD Athlon XP 2700+ (256kb on-die L2 Cache) PDF Data Sheet
    RAM : 2x512 PC3200 modules-88L5HDL0-1RDG
    MOBO : Gigabyte GA-7VAXP Ultra
    HDD : WD800BB (80gig), WD800JB (80gig)
    DVD DRIVE : Sony DRU-500A
    CD DRIVE : AOPEN 52x48x52 CD-RW
    VIDEO : GeForce FX5900 (OC'd to 10MHz below the 5950 Ultra)
    AUDIO : Creative Sound Blaster Audigy 2
    CAPTURE : Conexant Mpeg video capture card
    3D : Direct X 9.0b

    A+ and Net+ Certified (so far)

    Quote of the day
    “Success is never final. Failure is never fatal.” -Winston Churchill


    - - - Recommended Programs - - -
    AdAware - - Spybot Search & Destroy - - Hijack This - - Everest Home Edition

    Want to know if a program is naughty? Go to Sysinfo.org to find out ! !

  3. #3
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    1,743
    Yes. The batch processor functions exactly as if you typed the commands from the command line. Leaving aside any possible external influence like TSRs, once an executable like scandisk (which of course should be run before defrag... ), has control, the batch processor is not functional until the program ends and the DOS EXEC function hands control back to the batch processor to process the next batch instruction.

    Edit: we are talking about a DOS batch file aren't we?
    Last edited by Platypus; October 2nd, 2003 at 08:15 AM.

  4. #4
    Join Date
    Sep 2003
    Location
    Florida
    Posts
    1,494
    If that is true, why were my game servers starting all up at once? Was I not putting in the right commands?
    .*TaNgZ*.

    **(Outdated)Power Machiene**
    **Tripple Boot System**
    Operating Systems
    : Windows 2000 SP4; Windows XP Pro; SuSE Linux 9.1
    CPU : AMD Athlon XP 2700+ (256kb on-die L2 Cache) PDF Data Sheet
    RAM : 2x512 PC3200 modules-88L5HDL0-1RDG
    MOBO : Gigabyte GA-7VAXP Ultra
    HDD : WD800BB (80gig), WD800JB (80gig)
    DVD DRIVE : Sony DRU-500A
    CD DRIVE : AOPEN 52x48x52 CD-RW
    VIDEO : GeForce FX5900 (OC'd to 10MHz below the 5950 Ultra)
    AUDIO : Creative Sound Blaster Audigy 2
    CAPTURE : Conexant Mpeg video capture card
    3D : Direct X 9.0b

    A+ and Net+ Certified (so far)

    Quote of the day
    “Success is never final. Failure is never fatal.” -Winston Churchill


    - - - Recommended Programs - - -
    AdAware - - Spybot Search & Destroy - - Hijack This - - Everest Home Edition

    Want to know if a program is naughty? Go to Sysinfo.org to find out ! !

  5. #5
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    1,743
    I wondered too when we reached different conclusions. Being in the Win3.1/DOS forum, I guessed the .bat was being run in real DOS, in which case what I said should be correct, DOS is not multi-threaded. What OS were you running the batch under, TangZ?

    Once a Win32 server is started, it's an independent process in its own right, the batch file, as you say, is not aware of it any more and goes on with what it's doing. If programs are being run in DOS, it's quite different.
    Last edited by Platypus; October 2nd, 2003 at 09:40 AM.

  6. #6
    Join Date
    Sep 2003
    Location
    Florida
    Posts
    1,494
    AHHHH you are correct I completely forgot it runs different in real mode on older versions (I run 2000 and XP), but the commands should be the same... shouldnt they?
    .*TaNgZ*.

    **(Outdated)Power Machiene**
    **Tripple Boot System**
    Operating Systems
    : Windows 2000 SP4; Windows XP Pro; SuSE Linux 9.1
    CPU : AMD Athlon XP 2700+ (256kb on-die L2 Cache) PDF Data Sheet
    RAM : 2x512 PC3200 modules-88L5HDL0-1RDG
    MOBO : Gigabyte GA-7VAXP Ultra
    HDD : WD800BB (80gig), WD800JB (80gig)
    DVD DRIVE : Sony DRU-500A
    CD DRIVE : AOPEN 52x48x52 CD-RW
    VIDEO : GeForce FX5900 (OC'd to 10MHz below the 5950 Ultra)
    AUDIO : Creative Sound Blaster Audigy 2
    CAPTURE : Conexant Mpeg video capture card
    3D : Direct X 9.0b

    A+ and Net+ Certified (so far)

    Quote of the day
    “Success is never final. Failure is never fatal.” -Winston Churchill


    - - - Recommended Programs - - -
    AdAware - - Spybot Search & Destroy - - Hijack This - - Everest Home Edition

    Want to know if a program is naughty? Go to Sysinfo.org to find out ! !

  7. #7
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    1,743
    I think the commands would be the same, except for any Win2000 or XP enhancements to the batch language. The difference would be I'm assuming Dexahol's query is for real mode DOS.

  8. #8
    Join Date
    Jun 2001
    Location
    Jacksonville,Fl,USA
    Posts
    341
    Just to clarify, this is a pure DOS 6.22 machine.

    Dex

    (And I believe platypus answered the question, Thanks.)

  9. #9
    Join Date
    Sep 2003
    Location
    Florida
    Posts
    1,494
    ummm, just a little curious...whay would you WANT an all dos machiene? why not UNIX or LINUX....?
    .*TaNgZ*.

    **(Outdated)Power Machiene**
    **Tripple Boot System**
    Operating Systems
    : Windows 2000 SP4; Windows XP Pro; SuSE Linux 9.1
    CPU : AMD Athlon XP 2700+ (256kb on-die L2 Cache) PDF Data Sheet
    RAM : 2x512 PC3200 modules-88L5HDL0-1RDG
    MOBO : Gigabyte GA-7VAXP Ultra
    HDD : WD800BB (80gig), WD800JB (80gig)
    DVD DRIVE : Sony DRU-500A
    CD DRIVE : AOPEN 52x48x52 CD-RW
    VIDEO : GeForce FX5900 (OC'd to 10MHz below the 5950 Ultra)
    AUDIO : Creative Sound Blaster Audigy 2
    CAPTURE : Conexant Mpeg video capture card
    3D : Direct X 9.0b

    A+ and Net+ Certified (so far)

    Quote of the day
    “Success is never final. Failure is never fatal.” -Winston Churchill


    - - - Recommended Programs - - -
    AdAware - - Spybot Search & Destroy - - Hijack This - - Everest Home Edition

    Want to know if a program is naughty? Go to Sysinfo.org to find out ! !

  10. #10
    Join Date
    Jun 2001
    Location
    Jacksonville,Fl,USA
    Posts
    341
    heh-heh - the answer would fill a book, but since I don't have that much time or space. . . I'll hit the highlights:

    DOS is simply fun. I never wonder what DOS is doing behind my back.

    I'm using it to develop an in-car mp3 player using MPXPLAY. DOS is unique in that it can be shutdown with the power switch.

    I also play with QuickBASIC 4.5. It just works better, (read: simpler), in the pure DOS environment.

    Then there's all the old games that I occasionaly play.
    Experimenting with batch files, without worry about wiping out something important.

    And then, there's just the ability to maintain ones familiarity with the command prompt, without worrying about the impact of a mistake. I can completely reinstall my DOS system in about 5 minutes. (With all software.)

    The list goes on forever!

    Dex

    Edit: Almost forgot the most important of all. With older machines being available at flea markets for $10 - $50, you can have one of each: DOS, Win3.x, Win 9.x, Linux, for the cost of a decent sound card. Switch them through a KVM switch, and you can do anything.
    Last edited by Dexahol; October 2nd, 2003 at 01:26 PM.

  11. #11
    Join Date
    Sep 2003
    Location
    Florida
    Posts
    1,494
    In car cd player through dos huh...Id love to see some info or prototype pics on that if you have it posted on the web!!!
    .*TaNgZ*.

    **(Outdated)Power Machiene**
    **Tripple Boot System**
    Operating Systems
    : Windows 2000 SP4; Windows XP Pro; SuSE Linux 9.1
    CPU : AMD Athlon XP 2700+ (256kb on-die L2 Cache) PDF Data Sheet
    RAM : 2x512 PC3200 modules-88L5HDL0-1RDG
    MOBO : Gigabyte GA-7VAXP Ultra
    HDD : WD800BB (80gig), WD800JB (80gig)
    DVD DRIVE : Sony DRU-500A
    CD DRIVE : AOPEN 52x48x52 CD-RW
    VIDEO : GeForce FX5900 (OC'd to 10MHz below the 5950 Ultra)
    AUDIO : Creative Sound Blaster Audigy 2
    CAPTURE : Conexant Mpeg video capture card
    3D : Direct X 9.0b

    A+ and Net+ Certified (so far)

    Quote of the day
    “Success is never final. Failure is never fatal.” -Winston Churchill


    - - - Recommended Programs - - -
    AdAware - - Spybot Search & Destroy - - Hijack This - - Everest Home Edition

    Want to know if a program is naughty? Go to Sysinfo.org to find out ! !

  12. #12
    Join Date
    Oct 1999
    Location
    Huntington Beach, CA, USA
    Posts
    3,137
    I would put:
    @echo off
    call scandisk c: /AUTOFIX /SURFACE
    call defrag c: /F /SNE

    This makes it come back to the Batch file when the process is done. Otherwise it may run scandisk and stop. You might add
    pause

    between the commands if it does run through to the second command. That would be primarily for Windows.

    ------------------
    My
    Two Cents
    Dennis
    Visit Politalk

  13. #13
    Join Date
    Jun 2001
    Location
    Jacksonville,Fl,USA
    Posts
    341
    TangZ; This is actually a pretty popular thing to do. Peruse this forum for a bit.
    BTW - It'll actually be an in-car MP3 player, with hard drive. (No CD)

    Eeyore; I probably shouldn't have used that example. The "defrag" and "scandisk" thing was purely for the sake of example. The actual commands I'll be using are some various Norton Utilities functions that I want to automate.

    But I do appreciate your comments. I will store that info away just for reference.

    Dex
    Last edited by Dexahol; October 2nd, 2003 at 07:03 PM.

  14. #14
    Join Date
    Feb 2000
    Location
    26.03°N 80.14°W
    Posts
    9,410
    If you're running Windows 9x and you want DOS to wait for one of your program to finish before starting another, prefix the first program with "START /W". For example:
    Code:
    @echo off
    :SCANFRAG.BAT
    start /w scandskw /allfixeddisks /noninteractive /silent
    defrag /all /f /detailed /noprompt
    for %%x in (cls exit) do %%x
    Now DEFRAG won't start until SCANDSKW has exited.

    For more info, type
    • start /?
    at any DOS prompt and see this Microsoft KB page: How to Start Programs Sequentially in Windows
    Vernon Frazee, Microsoft MVP (Windows - Shell/User)

    Defenses Up!
    Tip: When prompted for a password, give an incorrect one first. A phishing site will accept it; a legitimate one won't.


    Inside Spyware: A Guide to Finding, Removing and Preventing Online Pests


    If you don't keep up with security fixes, your computer|network won't be yours for long.

  15. #15
    Join Date
    Jun 2001
    Location
    Jacksonville,Fl,USA
    Posts
    341
    Thanks for that great info and link Vernon.
    I didn't know that.

    Dex

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •