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

Author Topic: (solved)defragmentation at startup.(Pause for x many seconds?)  (Read 17396 times)

0 Members and 1 Guest are viewing this topic.

Jonas Wauters

    Topic Starter


    Adviser

  • My Skatevids Check Signature
  • Thanked: 2
    Is there a way how you can take a pause for x many seconds in a batch file?
    Without having to download the wait attribute.

    Thanks in advance Jonas
    « Last Edit: May 20, 2007, 09:23:15 AM by Jonas Wauters »

    Nuclear Playboy

    • Guest
    Re: Pause for x many seconds?
    « Reply #1 on: May 03, 2007, 05:13:24 PM »
    You can use the
    Code: [Select]
    TIMEOUT  nn    [RK] Only works if you have the NT resource kit.

     nn = seconds.

    Do you have RK?

    2k_dummy



      Specialist
    • A word, once spoken, can never be recalled.
    • Thanked: 14
      Re: Pause for x many seconds?
      « Reply #2 on: May 04, 2007, 07:34:30 AM »
      ping 1.1.1.1 -n 10 -w 1000 >%tmp%null

      This example would be a 10 second delay. Change the 10 to the desired number of second and insert the line at the point you want the delay. Its not as precise as a real timer but its close enough.
      If you don't stand for something, you'll fall for anything.
      _______________________________________ ________
      BlackViper

      Software and utilities

      Dark Blade

      • Forum Gaming Master


      • Adviser

        Thanked: 24
        • Yes
      • Experience: Experienced
      • OS: Windows XP
      Re: Pause for x many seconds?
      « Reply #3 on: May 05, 2007, 05:54:44 PM »
      Code: [Select]
      @echo off
      set /p TIMER=How long to wait?
      cls
      ping 1.1.1.1 -n %TIMER% -w 1000 > nul

      Use that code if you want to prompt for how long to wait.

      Jonas Wauters

        Topic Starter


        Adviser

      • My Skatevids Check Signature
      • Thanked: 2
        Re: Pause for x many seconds?
        « Reply #4 on: May 06, 2007, 03:40:29 AM »
        I do not have RK and its not a real solution for my problem.
        I want to create a program with I save on my shared drive.
        The program needs to defrag all the drives and the user should have the chose with he wants to do after the program is done.
        This is it thaks to this forum
        Code: [Select]
        Title Defragmenteren
        @echo off
        cls
        echo Dit programma is gemaakt door Jonas Wauters.
        echo Dit programma defragmenteerd C: en D: schijf.
        echo Defragmentatie zorgt voor een optimaal gebruik van uw harde schijven.
        Ping 1.1.1.1 -n 15 -w 1000 > nul
        cls
        echo Wat wil je doen nadat het process voltooid is?
        echo 1:De computer afsluiten
        echo 2:De computer opnieuw opstarten
        echo 3:Dit venster afsluiten en gewoon verdergaan met werken
        Set /P Quit=Typ (1,2of 3)
        Vol C:
        defrag -f C:
        If not exist d: GOTO e
        vol d:
        defrag -f d:
        :e
        if not exist e: GOTO f
        vol e:
        defrag -f e:
        :f
        if not exist F: goto g
        vol f:
        defrag -f f:
        :g
        If %Quit%=1 then goto Q1
        If %Quit%=1 then goto Q2
        Exit
        :Q1
        Shutdown -s -f -t 25 -c "Sla al u gegevens op voordat de timer op 0 staat want dan zal de computer afsluiten!"
        :Q2
        Shutdown -r -f -t 25 -c "Sla al u gegevens op voordat de timer op 0 staat want dan zal de computer opnieuw opstarten!"
        shutdown -s -t 01
        It is written in dutch

        Jonas Wauters

          Topic Starter


          Adviser

        • My Skatevids Check Signature
        • Thanked: 2
          Re: Pause for x many seconds?
          « Reply #5 on: May 06, 2007, 09:54:15 AM »
          Can you create a count down that you can skip with the enterkey?
          If this isn't possible please say so.
          Thanks

          Nuclear Playboy

          • Guest
          Re: Pause for x many seconds?
          « Reply #6 on: May 06, 2007, 03:03:50 PM »
          Out of curiosity, what does the shutdown comment say?  :)

          Dark Blade

          • Forum Gaming Master


          • Adviser

            Thanked: 24
            • Yes
          • Experience: Experienced
          • OS: Windows XP
          Re: Pause for x many seconds?
          « Reply #7 on: May 08, 2007, 12:02:49 AM »
          If you wanted, you could download the Wait program for Command Prompt, where the computer waits a said amount of time, but it can aborted with space.

          I don't know the site where you can download it, so just Google it. (if anyone knows, post it)

          WillyW



            Specialist
          • Thanked: 29
          • Experience: Experienced
          • OS: Windows XP
          Re: Pause for x many seconds?
          « Reply #8 on: May 08, 2007, 09:12:03 AM »
          If you wanted, you could download the Wait program for Command Prompt, where the computer waits a said amount of time, but it can aborted with space.

          I don't know the site where you can download it, so just Google it. (if anyone knows, post it)

          See:
          http://www.computerhope.com/forum/index.php/topic,34932.0/all.html

          « Reply #16 on: May 01, 2007, 11:24:57 AM »



          But -  the original poster of this thread is also the original poster of that thread, and is therefore aware of it.    I think he meant to exclude it as an option, in his first post here when he referred to it as "wait attribute".



          .



          Jonas Wauters

            Topic Starter


            Adviser

          • My Skatevids Check Signature
          • Thanked: 2
            Re: Pause for x many seconds?
            « Reply #9 on: May 08, 2007, 09:24:40 AM »
            Wait isn't usefull in this situation.
            I use it on the network and it is used by 4 computers sow if I use Wait then all those computers should download the wait applecation.
            Code: [Select]
            :Q1
            Shutdown -s -f -t 25 -c "Sla al u gegevens op voordat de timer op 0 staat want dan zal de computer afsluiten!"
            :Q2
            Shutdown -r -f -t 25 -c "Sla al u gegevens op voordat de timer op 0 staat want dan zal de computer opnieuw opstarten!"
            shutdown -s -t 01
            Comment of Q1 Save all your setting before the countdown is completed because then the computer will be forced to shutdown.
            Comment of Q2 Save all your setting before the countdown is completed because then the computer will be forced to restart.
            « Last Edit: May 08, 2007, 10:22:53 AM by Jonas Wauters »

            GuruGary



              Adviser
              Re: Pause for x many seconds?
              « Reply #10 on: May 08, 2007, 04:36:37 PM »
              The ping is useful for a generic timer where you don't know what resources will be available, or you don't want to rely on extra programs, so that is a great solution.  I do have 1 comment and 1 suggestion, though:
              • Instead of pinging a public IP address, ping yourself (localhost)
                The formula is actually ping n+1 localhost >NUL where n is  the number of seconds to pause.

              The reason to ping localhost instead of a real IP address is many reasons.  Post back if you really want to know what some of them are.

              The reason you need to add 1 to the number of seconds to ping is because the first ping gets executed immediately, and there is about 1 second between the rest.

              Jonas Wauters

                Topic Starter


                Adviser

              • My Skatevids Check Signature
              • Thanked: 2
                Re: Pause for x many seconds?
                « Reply #11 on: May 13, 2007, 08:44:55 AM »
                Yes it would be wonderful to know that reason.
                And what do you mean white about one second?(Does it change from time to time or is it always just e.g. .999 seconds or something?)
                And is there any way how I can run my program when I boot just before I get the welcome screen?
                Thanks for the reply.
                sorry that I noticed it so late.

                Jonas ;)

                2k_dummy



                  Specialist
                • A word, once spoken, can never be recalled.
                • Thanked: 14
                  Re: Pause for x many seconds?
                  « Reply #12 on: May 13, 2007, 09:53:50 AM »
                  Quote
                  Ping 1.1.1.1 -n 15 -w 1000 > nul

                  1.1.1.1 is not a public address. It is non existant. You can substitute your local host if desired.
                  -n 15 is the number of pings to be sent
                  -w 1000 is the time, in ms, to wait between pings (1000ms = 1 sec)

                  As I stated before, it is not perfect, but is close enough.

                  Quote
                  the first ping gets executed immediately

                  Its almost immediate. So adding an extra second will make it more accurate. However, there is a small amount of overhead so it would be slightly more than (time). Slightly over or slightly under, in this case, probably does not matter.
                  If you don't stand for something, you'll fall for anything.
                  _______________________________________ ________
                  BlackViper

                  Software and utilities

                  Jonas Wauters

                    Topic Starter


                    Adviser

                  • My Skatevids Check Signature
                  • Thanked: 2
                    Re: Pause for x many seconds?
                    « Reply #13 on: May 13, 2007, 03:56:44 PM »
                    No it doesn't matter in this case.
                    I do have an other question Diskeeper lite gives me the message that I need to defrag when my PC boots.
                    But to do that white that program I need to buy the full version.
                    Can't I just change the batch file so I can defrag when my PC boots?

                    Jonas ;)

                    2k_dummy



                      Specialist
                    • A word, once spoken, can never be recalled.
                    • Thanked: 14
                      Re: Pause for x many seconds?
                      « Reply #14 on: May 13, 2007, 04:33:27 PM »
                      You could try adding a line at the end of autoexec.nt in the system32 folder. Include the full path to the batch file.
                      If you don't stand for something, you'll fall for anything.
                      _______________________________________ ________
                      BlackViper

                      Software and utilities

                      GuruGary



                        Adviser
                        Re: Pause for x many seconds?
                        « Reply #15 on: May 13, 2007, 06:09:05 PM »
                        If you want the program to run when Windows loads, you will probably want to put a shortcut to the file (or batch file) in the Startup group.  If there is an icon that lets it run automatically, you can just copy that icon to
                        C:\Documents and Settings\All Users\Start Menu\Startup
                        Or you may need a batch file that starts it for you.  Is there a switch to get it to run without clicking an any buttons?  If so you could copy a batch file (or link to the batch file) to the Startup directory.  The batch file would probably look something like:
                        Code: [Select]
                        "C:\Program Files\Diskeeper\Diskeeper.exe" /defrag C:Note that I am guessing at the path, filename and switches since it has been a few years since I have used Diskeeper.

                        Jonas Wauters

                          Topic Starter


                          Adviser

                        • My Skatevids Check Signature
                        • Thanked: 2
                          Re: Pause for x many seconds?
                          « Reply #16 on: May 14, 2007, 10:04:39 AM »
                          First of all thanks for answering.
                          Code: [Select]
                          echo Wat wil je doen nadat het process voltooid is? [b]What do you want to do after the proces is compeled?[/b]
                          echo 1:De computer afsluiten [b]Shutdown computer[/b]
                          echo 2:De computer opnieuw opstarten [b]Reboot computer[/b]
                          echo 3:Dit venster afsluiten en gewoon verdergaan met werken [b]Just close this window[/b]
                          Set /P Quit=Typ (1,2of 3)
                          Can't I just add an option like "Reboot you computer and defrag on startup"
                          Sow then the computer should reboot and run that program before I get to the welcome screen it should pass the option partition.
                          It this possible what I'm asking?
                          Please if this thanks to long for you, than do not spend to much time with it.
                          I do not want to insist you.
                          But I do appreciate it.

                          Jonas ;)
                          « Last Edit: May 14, 2007, 10:31:20 AM by Jonas Wauters »

                          GuruGary



                            Adviser
                            Re: Pause for x many seconds?
                            « Reply #17 on: May 14, 2007, 10:28:58 AM »
                            I don't know much about Diskeeper, but I think the task you want is dependent on your software.   It sounds like what you really want is to schedule a defrag before the OS completes booting, similar to the way you can schedule a CHKDSK /F, is that correct?  If so, is it possible to schedule a defrag to launch at the next boot from within the program?  If you can do it within the program then I don't think it would be too hard to do.  If the program can't do it by itself,  then it is probably not practical to attempt to make the program do this.

                            Jonas Wauters

                              Topic Starter


                              Adviser

                            • My Skatevids Check Signature
                            • Thanked: 2
                              Re: Pause for x many seconds?
                              « Reply #18 on: May 14, 2007, 10:39:19 AM »
                              Yes it is possible white the program but that you have to have the Full version.
                              And then you have to pay for it.
                              But thats not really what I want to do.

                              Isn't it possible to create 2 batch files.
                              1 the one I allready have. and just add the option to defrag while booting.
                              When I choose that option than it should create:
                              You could try adding a line at the end of autoexec.nt in the system32 folder. Include the full path to the batch file.
                              Then it should create that to the full path of my second batch file.
                              The second batch file should defragment and then remove that line at autoexes.nt.
                              Is that possible?

                              Jonas ;)

                              GuruGary



                                Adviser
                                Re: Pause for x many seconds?
                                « Reply #19 on: May 14, 2007, 10:49:28 AM »
                                I don't think adding a line to your AUTOEXEC.NT will work.  I could be wrong, but I think that just loads the environment for when DOS programs are loaded from within Windows.  I don't think that the AUTOEXEC.NT gets executed when the computer boots / login, etc.

                                Jonas Wauters

                                  Topic Starter


                                  Adviser

                                • My Skatevids Check Signature
                                • Thanked: 2
                                  Re: Pause for x many seconds?
                                  « Reply #20 on: May 14, 2007, 10:59:51 AM »
                                  Can it do any harm by just trying it?
                                  Otherwise I'll just add my first batch file to try.
                                  Than how do I have to do that?
                                  By the way thanks for replying this fast.

                                  Jonas ;)

                                  GuruGary



                                    Adviser
                                    Re: Pause for x many seconds?
                                    « Reply #21 on: May 14, 2007, 03:40:03 PM »
                                    It won't do any harm by trying it.  You can always remove it from the AUTOEXEC.NT if it causes problems with your PIF files.

                                    I think the better solution is adding a batch file to your startup group.

                                    Starting the Diskeeper program isn't going to be that difficult.  But if you want it fully automated, I think there are buttons and icons to click on to get the defrag started, which will be difficult to script.

                                    Jonas Wauters

                                      Topic Starter


                                      Adviser

                                    • My Skatevids Check Signature
                                    • Thanked: 2
                                      Re: Pause for x many seconds?
                                      « Reply #22 on: May 15, 2007, 10:36:51 AM »
                                      I can't edit autoexe.nt or do I have to do it otherwise than right clicking it and go to edit (because edit is missing.)
                                      If I put my Batch file in the startup file than it'll run when I get my desktop and not before the welcome screen sow it will not be able to defrag  the running processes.
                                      Starting the Diskeeper program isn't going to be that difficult.  But if you want it fully automated, I think there are buttons and icons to click on to get the defrag started, which will be difficult to script.
                                      Yes but then it will again be after the welcome screen.
                                      Or am I wrong??

                                      Jonas ;)

                                      2k_dummy



                                        Specialist
                                      • A word, once spoken, can never be recalled.
                                      • Thanked: 14
                                        Re: Pause for x many seconds?
                                        « Reply #23 on: May 15, 2007, 11:27:41 AM »
                                        You can open and edit autoexec.nt in Notepad.
                                        If you don't stand for something, you'll fall for anything.
                                        _______________________________________ ________
                                        BlackViper

                                        Software and utilities

                                        GuruGary



                                          Adviser
                                          Re: Pause for x many seconds?
                                          « Reply #24 on: May 15, 2007, 11:29:17 AM »
                                          You are right, both ways would be after the welcome screen.

                                          The autoexec.nt won't start the defrag before the welcome screen either, though.  But to edit the file, try this:
                                          Start -> Run -> notepad %windir%\System32\autoexec.nt

                                          Jonas Wauters

                                            Topic Starter


                                            Adviser

                                          • My Skatevids Check Signature
                                          • Thanked: 2
                                            Re: Pause for x many seconds?
                                            « Reply #25 on: May 16, 2007, 03:59:28 AM »
                                            If autoexe.nt doesn't extrude before the welcome screen then it also isn't a solution.
                                            Maybe safemode but then there are still some running processes.
                                            Sow I think it is just impossible.
                                            Thanks for helping.

                                            Jonas ;)

                                            contrex

                                            • Guest
                                            Re: Pause for x many seconds?
                                            « Reply #26 on: May 16, 2007, 04:34:22 AM »
                                            start button
                                            Run
                                            Gpedit.msc
                                            Windows Settings
                                            Scripts (Startup/Shutdown)
                                            Startup
                                            Add Script

                                            Quote
                                            To assign computer startup scripts
                                            Open the Group Policy snap-in.
                                            In the console tree, click Scripts (Startup/Shutdown).
                                            In the details pane, double-click Startup.
                                            In the Startup Properties dialog box, click Add.
                                            In the Add a Script dialog box, type the following information, and then click OK:
                                            Script Name: Type the path to the script, or click Browse to search for the script file in the Netlogon share of the domain controller.

                                            Script Parameters: Type any parameters that you want, the same way as you would type them on the command line. For example, if your script includes parameters called //logo (display banner) and //I (interactive mode), type the following: //logo //I



                                            Jonas Wauters

                                              Topic Starter


                                              Adviser

                                            • My Skatevids Check Signature
                                            • Thanked: 2
                                              Re: Pause for x many seconds?
                                              « Reply #27 on: May 19, 2007, 12:54:52 PM »
                                              start button
                                              Run
                                              Gpedit.msc
                                              Windows Settings
                                              Scripts (Startup/Shutdown)
                                              Startup
                                              Add Script

                                              Quote
                                              To assign computer startup scripts
                                              Open the Group Policy snap-in.
                                              In the console tree, click Scripts (Startup/Shutdown).
                                              In the details pane, double-click Startup.
                                              In the Startup Properties dialog box, click Add.
                                              In the Add a Script dialog box, type the following information, and then click OK:
                                              Script Name: Type the path to the script, or click Browse to search for the script file in the Netlogon share of the domain controller.

                                              Script Parameters: Type any parameters that you want, the same way as you would type them on the command line. For example, if your script includes parameters called //logo (display banner) and //I (interactive mode), type the following: //logo //I



                                              I've tried this but it doesn't seem to work.
                                              Code: [Select]
                                              Title Defragmenteren
                                              @echo off
                                              cls
                                              echo Dit programma is gemaakt door Jonas Wauters.
                                              echo Dit programma defragmenteerd C: en D: schijf.
                                              echo Defragmentatie zorgt voor een optimaal gebruik van uw harde schijven.
                                              Ping 1.1.1.1 -n 5 -w 1000 > nul
                                              cls
                                              echo Wat wil je doen nadat het process voltooid is?
                                              echo 1:De computer afsluiten
                                              echo 2:De computer opnieuw opstarten
                                              echo 3:Dit venster afsluiten en gewoon verdergaan met werken
                                              Set /P Quit=Typ (1,2of 3):
                                              Vol C:
                                              defrag -f C:
                                              If not exist d: GOTO e
                                              vol d:
                                              defrag -f d:
                                              :e
                                              if not exist e: GOTO f
                                              vol e:
                                              defrag -f e:
                                              :f
                                              if not exist F: GOTO g
                                              vol f:
                                              defrag -f f:
                                              :g
                                              If %Quit%=1 then GOTO Q1
                                              If %Quit%=1 then GOTO Q2
                                              This is the code of the program I want to run after startup I dind't fil in any Parameters.
                                              Or is this my mistake?

                                              Thanks for this post I hope that I just made a mistake.

                                              Jonas ;)
                                              « Last Edit: May 19, 2007, 03:00:01 PM by Jonas Wauters »

                                              Jonas Wauters

                                                Topic Starter


                                                Adviser

                                              • My Skatevids Check Signature
                                              • Thanked: 2
                                                Re: Pause for x many seconds?
                                                « Reply #28 on: May 19, 2007, 01:42:33 PM »
                                                I think I should make a new topic on this-one.
                                                Should I?

                                                contrex

                                                • Guest
                                                Re: Pause for x many seconds?
                                                « Reply #29 on: May 19, 2007, 01:45:19 PM »
                                                I think the scripts that execute before login are special in some way.

                                                In your script,

                                                you should not have "then"

                                                If %Quit%=1 then GOTO Q1
                                                If %Quit%=1 then GOTO Q2

                                                What does the second of those lines do?

                                                And where are labels Q1 and Q2?

                                                Jonas Wauters

                                                  Topic Starter


                                                  Adviser

                                                • My Skatevids Check Signature
                                                • Thanked: 2
                                                  Re: Pause for x many seconds?
                                                  « Reply #30 on: May 19, 2007, 02:08:41 PM »
                                                  Here is the newer vesion:
                                                  Code: [Select]
                                                  If %Quit%=1 GOTO Q1
                                                  If %Quit%=1 GOTO Q2
                                                  Exit
                                                  :Q1
                                                  Shutdown -s -f -t 25 -c "Sla al u gegevens op voordat de timer op 0 staat want dan zal de computer afsluiten!"
                                                  :Q2
                                                  Shutdown -r -f -t 25 -c "Sla al u gegevens op voordat de timer op 0 staat want dan zal de computer opnieuw opstarten!"
                                                  shutdown -s -t 01
                                                  I forgot to post the end of the batch file srry for that.
                                                  But still can you give an answer on my question why you methode doesn't work?
                                                  By the way thanks for helping.

                                                  GuruGary



                                                    Adviser
                                                    Re: Pause for x many seconds?
                                                    « Reply #31 on: May 19, 2007, 02:38:38 PM »
                                                    Instead of pinging "1.1.1.1", you should ping either "localhost" or "127.0.0.1", like:
                                                    Code: [Select]
                                                    ping localhost -n 5 >nul
                                                    Also add some sort of extra text in your string comparison which will reduce the possibility of errors or warnings if the user enters a blank value for "Quit".  Also, use double equal signs (==), like:
                                                    Code: [Select]
                                                    If {%Quit%}=={1} GOTO Q1
                                                    If {%Quit%}=={2} GOTO Q2


                                                    Jonas Wauters

                                                      Topic Starter


                                                      Adviser

                                                    • My Skatevids Check Signature
                                                    • Thanked: 2
                                                      Re: Pause for x many seconds?
                                                      « Reply #32 on: May 19, 2007, 02:59:26 PM »
                                                      This is my newist version after editing those mistakes.
                                                      Code: [Select]
                                                      Title Defragmenteren
                                                      @echo off
                                                      cls
                                                      echo Dit programma is gemaakt door Jonas Wauters.
                                                      echo Dit programma defragmenteerd C: en D: schijf.
                                                      echo Defragmentatie zorgt voor een optimaal gebruik van uw harde schijven.
                                                      Ping localhost -n 2 > nul
                                                      echo 5
                                                      Ping localhost -n 2 > nul
                                                      echo 4
                                                      Ping localhost -n 2 > nul
                                                      echo 3
                                                      Ping localhost -n 2 > nul
                                                      echo 2
                                                      Ping localhost -n 2 > nul
                                                      echo 1
                                                      Ping localhost -n 2 > nul
                                                      cls
                                                      echo Wat wil je doen nadat het process voltooid is?
                                                      echo 1:De computer afsluiten
                                                      echo 2:De computer opnieuw opstarten
                                                      echo 3:Dit venster afsluiten en gewoon verdergaan met werken
                                                      :Retry
                                                      Set /P Quit=Typ (1,2of 3):
                                                      If {%Quit%}>3 GOTO error
                                                      Vol C:
                                                      defrag -f C:
                                                      If not exist d: GOTO e
                                                      vol d:
                                                      defrag -f d:
                                                      :e
                                                      if not exist e: GOTO f
                                                      vol e:
                                                      defrag -f e:
                                                      :f
                                                      if not exist F: GOTO g
                                                      vol f:
                                                      defrag -f f:
                                                      :g
                                                      If {%Quit%}=={1} GOTO Q1
                                                      If {%Quit%}=={1} GOTO Q2
                                                      Exit
                                                      :Q1
                                                      Shutdown -s -f -t 25 -c "Sla al u gegevens op voordat de timer op 0 staat want dan zal de computer afsluiten!"
                                                      :Q2
                                                      Shutdown -r -f -t 25 -c "Sla al u gegevens op voordat de timer op 0 staat want dan zal de computer opnieuw opstarten!"
                                                      shutdown -s -t 01
                                                      :error
                                                      Echo Dit is geen mogelijkheid gevieve opnieuw te proberen.
                                                      GOTO Retry
                                                      Actually would it have worked on my way?
                                                      Again thanks for showing me my mistakes but isn't there a way to run this program at startup before the welcome screen?

                                                      Jonas ;)

                                                      GuruGary



                                                        Adviser
                                                        Re: Pause for x many seconds?
                                                        « Reply #33 on: May 20, 2007, 12:38:17 AM »
                                                        The only way I can think of to run the script before the Welcome Screen is Contrex's idea about using the Group Policy startup script.  I think the GP startup scripts run before the Welcome Screen.  I also think that if it is going to work, you would need to remove any prompts for the user, as there will not be a console to display any output.  So if it were to work, you would have to change the script to something like
                                                        Code: [Select]
                                                        defrag -f C:
                                                        defrag -f D:
                                                        defrag -f E:
                                                        defrag -f F:
                                                        and it would defrag every time the computer booted.  I think it will run as a process in the background, so you could still log in while it was defragging.  The computer would probably run slow until the defrag was finished, unless you killed the process with a program like TASKMGR or TASKKILL.

                                                        Jonas Wauters

                                                          Topic Starter


                                                          Adviser

                                                        • My Skatevids Check Signature
                                                        • Thanked: 2
                                                          Re:defragmentation at startup. (Pause for x many seconds?)
                                                          « Reply #34 on: May 20, 2007, 12:48:18 AM »
                                                          But F: is a removable disk and isn't always attached.
                                                          are you sure that it will not work if I use:
                                                          Code: [Select]
                                                          defrag -f E:
                                                          defrag -f D:
                                                          defrag -f E:
                                                          if exists F: defrag -f F:
                                                          I also think that if it is going to work, you would need to remove any prompts for the user, as there will not be a console to display any output.
                                                          How do I have to do this?
                                                          I tryed it but I can't find any process My program is called "boot defragmentation.bat" but the only process I can find is "defrag.exe".

                                                          (edit)
                                                          Jonas ;)
                                                          « Last Edit: May 20, 2007, 07:43:24 AM by Jonas Wauters »

                                                          GuruGary



                                                            Adviser
                                                            Re: defragmentation at startup.(Pause for x many seconds?)
                                                            « Reply #35 on: May 20, 2007, 09:07:55 AM »
                                                            The code you have should be fine the way it is written.  Using the code you posted, you have already removed all prompts for the user.

                                                            The process you would have to end would be one or more of:
                                                            defrag.exe
                                                            dfrgntfs.exe
                                                            dfrgfat.exe

                                                            And you may have to end them as many as 4 times (once for each drive letter).  Or better yet, let them run until they finish, or run the defrag command manually.

                                                            Jonas Wauters

                                                              Topic Starter


                                                              Adviser

                                                            • My Skatevids Check Signature
                                                            • Thanked: 2
                                                              Re: (solved)defragmentation at startup.(Pause for x many seconds?)
                                                              « Reply #36 on: May 20, 2007, 09:21:55 AM »
                                                              OK thanks for all the help I really appreciate it.
                                                              Now it works fine.

                                                              Jonas ;)