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

Author Topic: New member, New DOS adventurer.  (Read 19566 times)

0 Members and 1 Guest are viewing this topic.

robertwig

    Topic Starter


    Rookie
  • The Dos and Don'ts of my new life
    • Experience: Beginner
    • OS: Windows 7
    Re: New member, New DOS adventurer.
    « Reply #30 on: January 23, 2014, 07:30:06 AM »
    If you can do without it then you should know what the /S option does and realize why it is taking so long to run when the folder does not exist.

    Wow, the removal of /s did allow completeion quickly. I thought I had a programming script error. I wonder how long it would have taken to complete with the /s still in. I waited 5 minutes and it was still running!

    Your tip has made my day, thanks.

    foxidrive



      Specialist
    • Thanked: 268
    • Experience: Experienced
    • OS: Windows 8
    Re: New member, New DOS adventurer.
    « Reply #31 on: January 23, 2014, 08:04:13 AM »
    I didn't realise your folder was always in the root directory.   

    That will certainly speed it up without the /s :)

    It's funny that you now claim you only have a c: drive and cdrom, because in an earlier post you said

    Quote
    but the backups will ultimately go to a network drive we share in our home.

    robertwig

      Topic Starter


      Rookie
    • The Dos and Don'ts of my new life
      • Experience: Beginner
      • OS: Windows 7
      Re: New member, New DOS adventurer.
      « Reply #32 on: January 23, 2014, 12:49:44 PM »
      I didn't realise your folder was always in the root directory.   

      That will certainly speed it up without the /s :)

      It's funny that you now claim you only have a c: drive and cdrom, because in an earlier post you said

      I'm just testing in my bare bones environment on a notebook. the util will run on my desktop in a shared environment with my family.

      robertwig

        Topic Starter


        Rookie
      • The Dos and Don'ts of my new life
        • Experience: Beginner
        • OS: Windows 7
        Re: New member, New DOS adventurer.
        « Reply #33 on: January 23, 2014, 01:27:56 PM »
        It seems I am not quite there yet.
        The following code returns the data I wish to use (drive letter and folder name) but does not loop through all the drives on my system:

        cd \
        echo
        for /f "tokens=1,2 delims=:" %%A in ('dir /d MyOFFSetupFiles ^| findstr "\<Directory of\>"') do (
        for /f "tokens=1-3 delims= " %%G in ("%%A") do (set "findPath=%%I:%%B" & set drvltr=%%I) )
        echo drive is %drvltr%
        echo folder path is %findpath%
        pause

        This routine does a loops through all the drives but without the /S option on the DIR cmd I don't capture the data I need (drive letter and folder name). With the /s option, it takes too long if the condition is non existant.

        cd \
        rem echo off
        for %%a in (c d e f g h i j k l m n o p q r s t u v w x y z) do (if exist %%a:\ for /f "delims=" %%b in ('dir "%%a:\MyOFFSetupFiles" /ad /b /s') do set "var=%%b" & goto :folderfound)
        @echo Folder MyOFFSetupFiles does not exist
        @echo program terminating
        timeout 4
        exit
        :folderfound
        echo %var%
        for /f "tokens=1,2 delims=\" %%i in ("%var%") do set "drvltr=%%i" & set "folder=%%j"
        set "path=%drvltr%\%folder%\
        @echo drive is: %drvltr%
        @echo folder is: %folder%
        @echo path is: %path%
        pause
        exit

        I have been trying to take the code that loops through the drives and build it into the first program but again I am having issues with the logic. Is there a way to merge the best of the two programs?

        Raven19528



          Hopeful
        • Thanked: 30
          • Computer: Specs
          • Experience: Experienced
          • OS: Windows 7
          Re: New member, New DOS adventurer.
          « Reply #34 on: January 23, 2014, 04:00:48 PM »
          I would suggest taking a look at Squashman's original suggestion.
          If you read the last section of the FOR /help.
          You might be surprised on how to do this a little simpler with the modifiers.
          If you work on your first block of code with those modifiers, you should be able to extract what you want very easily.

          Give it a shot and post back if you get stuck.
          "All things that are
          Are with more spirit chased than enjoy'd" -Shakespeare

          robertwig

            Topic Starter


            Rookie
          • The Dos and Don'ts of my new life
            • Experience: Beginner
            • OS: Windows 7
            Re: New member, New DOS adventurer.
            « Reply #35 on: January 23, 2014, 04:42:17 PM »
            I would suggest taking a look at Squashman's original suggestion. If you work on your first block of code with those modifiers, you should be able to extract what you want very easily.

            Give it a shot and post back if you get stuck.

            I looked at the for help on modifiers, but I don't see how they will help me with the ability  to Loop through all the potential drives like I have in the second block of code I posted. I must be missing something about your suggestion.

            Squashman



              Specialist
            • Thanked: 134
            • Experience: Experienced
            • OS: Other
            Re: New member, New DOS adventurer.
            « Reply #36 on: January 23, 2014, 07:37:55 PM »
            If this is a program that you are going to use on your family's computers and network to do some kind of backup why are we screwing around with trying to search and destroy for your program on every drive letter that might be connected to the system?  It is almost like you are trying to hide something or run something without anyone knowing where it is located. If this is for backup that makes no sense at all.

            Tell us what the true outcome of this batch file is supposed to be.

            foxidrive



              Specialist
            • Thanked: 268
            • Experience: Experienced
            • OS: Windows 8
            Re: New member, New DOS adventurer.
            « Reply #37 on: January 24, 2014, 12:48:59 AM »
            Why I have to explain all this is beyond me!!

            You should realise that people here give their time and experience for free, not asking anything in exchange, but expecting to be told accurate information about the task and any special details, like not wanting temporary files. 

            On that point the explanation you gave about temporary files seemed unlikely, and you've now said the task is just for home use so it makes even less sense.
            You also used the term 'clients' to begin with as if it was a business project.

            IDK which part of your explanations are to be believed.  Maybe none.

            robertwig

              Topic Starter


              Rookie
            • The Dos and Don'ts of my new life
              • Experience: Beginner
              • OS: Windows 7
              Re: New member, New DOS adventurer.
              « Reply #38 on: January 24, 2014, 05:05:17 AM »
              You should realise that people here give their time and experience for free, not asking anything in exchange, but expecting to be told accurate information about the task and any special details, like not wanting temporary files. 

              On that point the explanation you gave about temporary files seemed unlikely, and you've now said the task is just for home use so it makes even less sense.
              You also used the term 'clients' to begin with as if it was a business project.

              IDK which part of your explanations are to be believed.  Maybe none.

              Let me try and make this clear since you seem to be more concerned with how I use the program and whether it is in a subversive manner rather than focusing on the coding issue. Yes it is for family use to backup game a games forlder. If that works successfully I may make the batch file available to others (non family) to do the same through a games forum we  belong to, hence the term clients is a generic term I used in one of my description.

              your comment "If this is a program that you are going to use on your family's computers and network to do some kind of backup why are we screwing around with trying to search and destroy for your program on every drive letter that might be connected to the system? " implies the program is doing a "search and destroy" an assumption you have come to which is not reflected in any of the code I have put forward to date and is unfounded. Almost every piece of code that you guys help with could be used subversively if the end user wanted to do so. You have read my comments about family, clients, not wanting to use temp files and drawn your own conclusions which are off base.

              You stated: "You should realise that people here give their time and experience for free, not asking anything in exchange, but expecting to be told accurate information about the task and any special details, like not wanting temporary files."
              I realize and appreciate that fact and I did give accurate information as to what I expected from the code, but in my mind at the time I was thinking of everything bein internal. It never occured to me that temp files would be used. I personally think code kept internal is cleaner. If that is not your opinion that is fine but don't jump of the deep end and assume it has some kind of subversive intention.

              I hope this has clarified things, but I doubt it. You seem to be on some kind of mission, anyway let's put this rant to bed and either get on with things or not. Thanks.   


              foxidrive



                Specialist
              • Thanked: 268
              • Experience: Experienced
              • OS: Windows 8
              Re: New member, New DOS adventurer.
              « Reply #39 on: January 24, 2014, 07:00:03 AM »
              Do make sure you attribute quotes to the right person, there's a good chap.

              Several people have commented on this to you.

              Squashman



                Specialist
              • Thanked: 134
              • Experience: Experienced
              • OS: Other
              Re: New member, New DOS adventurer.
              « Reply #40 on: January 24, 2014, 07:10:04 AM »
              If it is a backup program there is no reason at all to not have the path to the script hard coded.

              robertwig

                Topic Starter


                Rookie
              • The Dos and Don'ts of my new life
                • Experience: Beginner
                • OS: Windows 7
                Re: New member, New DOS adventurer.
                « Reply #41 on: January 24, 2014, 09:49:55 AM »
                If it is a backup program there is no reason at all to not have the path to the script hard coded.

                You suggestions makes it necessary to predetermine on which drive the folders are installed and that would not be very flexible would it. A utility program should be more dynamic should it not?

                Squashman



                  Specialist
                • Thanked: 134
                • Experience: Experienced
                • OS: Other
                Re: New member, New DOS adventurer.
                « Reply #42 on: January 24, 2014, 10:19:44 AM »
                You suggestions makes it necessary to predetermine on which drive the folders are installed and that would not be very flexible would it. A utility program should be more dynamic should it not?
                That is what registry settings and INI files are for.

                Squashman



                  Specialist
                • Thanked: 134
                • Experience: Experienced
                • OS: Other
                Re: New member, New DOS adventurer.
                « Reply #43 on: January 24, 2014, 10:23:53 AM »
                Some script has to be located on your family members computer for them to execute for the utility to work.  How will it execute if nobody knows where it is.  You need some script on the person's computer that you actually KNOW where it is in order to execute all these commands.  You can't just blindly launch this script without knowing where it is.

                robertwig

                  Topic Starter


                  Rookie
                • The Dos and Don'ts of my new life
                  • Experience: Beginner
                  • OS: Windows 7
                  Re: New member, New DOS adventurer.
                  « Reply #44 on: January 24, 2014, 11:05:19 AM »
                  Some script has to be located on your family members computer for them to execute for the utility to work.  How will it execute if nobody knows where it is.  You need some script on the person's computer that you actually KNOW where it is in order to execute all these commands.  You can't just blindly launch this script without knowing where it is.

                  They would create a shortcut on their desktop for the batch utility and execute it whenever they felt the need to backup.