Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Writing a Batch File to Copy and Open File on CD  (Read 15161 times)

0 Members and 1 Guest are viewing this topic.

ghostdog74



    Specialist

    Thanked: 27
    Re: Writing a Batch File to Copy and Open File on CD
    « Reply #15 on: April 19, 2010, 10:16:56 PM »
    Actually you're not; if you read the code, fsutil is called once for each drive letter that exists.
    one don't normally (normal circumstances) have that much drives letters being used up , but however it that does occur, you would still need to go through that loop and test for each one. ie (if "Z" is really the drive letter for CDROM).
    I really should have said that he need to exit the loop once the CDROM drive letter is found so that he won't go through the rest of the letters.

    Salmon Trout

    • Guest
    Re: Writing a Batch File to Copy and Open File on CD
    « Reply #16 on: April 20, 2010, 12:16:04 AM »
    one don't normally (normal circumstances) have that much drives letters being used up , but however it that does occur, you would still need to go through that loop and test for each one. ie (if "Z" is really the drive letter for CDROM).
    I really should have said that he need to exit the loop once the CDROM drive letter is found so that he won't go through the rest of the letters.

    My CD-ROM drive letters are X on one machine and Z on another.

    If 26 letters take around 250 mS, why worry?


    ghostdog74



      Specialist

      Thanked: 27
      Re: Writing a Batch File to Copy and Open File on CD
      « Reply #17 on: April 20, 2010, 01:00:45 AM »
      If 26 letters take around 250 mS, why worry?
      well, that's fine if you are measuring against a simple task such as find a drive letter and that's all. In general if there are other intermediate tasks inside the for loop that needs to be performed, its still better to use a more efficient approach. I know, not everyone is a speed freak like me... :)

      BC_Programmer


        Mastermind
      • Typing is no substitute for thinking.
      • Thanked: 1140
        • Yes
        • Yes
        • BC-Programming.com
      • Certifications: List
      • Computer: Specs
      • Experience: Beginner
      • OS: Windows 11
      Re: Writing a Batch File to Copy and Open File on CD
      « Reply #18 on: April 20, 2010, 01:32:47 AM »
      well, that's fine if you are measuring against a simple task such as find a drive letter and that's all. In general if there are other intermediate tasks inside the for loop that needs to be performed, its still better to use a more efficient approach. I know, not everyone is a speed freak like me... :)

      a Speed freak that prefers interpreted languages?
      I was trying to dereference Null Pointers before it was cool.

      ghostdog74



        Specialist

        Thanked: 27
        Re: Writing a Batch File to Copy and Open File on CD
        « Reply #19 on: April 20, 2010, 02:39:15 AM »
        a Speed freak that prefers interpreted languages?
        almost what we do involves interpretation. You write a batch file, and its interpreted by cmd.exe. same as vbscript, Python ,Perl. etc.  When i mention "speed freak" i am talking about doing things in the most efficient way, short of writing a real C program (or what the heck, assembly) myself. I want the power and fast development time of an interpreted language as well. got that?

        Salmon Trout

        • Guest
        Re: Writing a Batch File to Copy and Open File on CD
        « Reply #20 on: April 20, 2010, 11:04:32 AM »
        doing things in the most efficient way

        That phrase is capable of so many differing interpretations

        ghostdog74



          Specialist

          Thanked: 27
          Re: Writing a Batch File to Copy and Open File on CD
          « Reply #21 on: April 20, 2010, 05:28:27 PM »
          That phrase is capable of so many differing interpretations
          like?

          Salmon Trout

          • Guest
          Re: Writing a Batch File to Copy and Open File on CD
          « Reply #22 on: April 21, 2010, 12:05:11 AM »
          think about it.

          ghostdog74



            Specialist

            Thanked: 27
            Re: Writing a Batch File to Copy and Open File on CD
            « Reply #23 on: April 21, 2010, 12:27:27 AM »
            think about it.

            i have already stated my case. doing thing the most efficient way,
            1) speed of development. with good data structures and ease of use of my tools, i can create programs to do my task in less than a few minutes.
            2) with a good tool, I can have better control of the things i want to do, reducing the chances of writing redundant code. With less redundant code, my program/script will run faster.

            If you are not going to say what you meant, then what's your point in posting?
            « Last Edit: April 21, 2010, 12:42:05 AM by ghostdog74 »

            Salmon Trout

            • Guest
            Re: Writing a Batch File to Copy and Open File on CD
            « Reply #24 on: April 21, 2010, 12:03:54 PM »
            well, that's fine if you are measuring against a simple task such as find a drive letter and that's all.

            That's what this thread is about.

            ghostdog74



              Specialist

              Thanked: 27
              Re: Writing a Batch File to Copy and Open File on CD
              « Reply #25 on: April 21, 2010, 06:18:28 PM »
              That's what this thread is about.
              yes, this thread is about that. But my replies all started with TC's comment on his batch's slowness,  not directly meant for the OP, trueparadox.