What's the equivalent to 'rm -rf' with Windows command?












12















I need to delete a whole directory (with a lot of sub directories and files) by running a command in a batch file.



I tried delete and erase, but both of them requires me to answer 'Y/N', and it doesn't seem to delete the directories if one has subdirectories or files.



What command can I use to delete a directory with subdirectories/files without whatever prompt?










share|improve this question





























    12















    I need to delete a whole directory (with a lot of sub directories and files) by running a command in a batch file.



    I tried delete and erase, but both of them requires me to answer 'Y/N', and it doesn't seem to delete the directories if one has subdirectories or files.



    What command can I use to delete a directory with subdirectories/files without whatever prompt?










    share|improve this question



























      12












      12








      12


      3






      I need to delete a whole directory (with a lot of sub directories and files) by running a command in a batch file.



      I tried delete and erase, but both of them requires me to answer 'Y/N', and it doesn't seem to delete the directories if one has subdirectories or files.



      What command can I use to delete a directory with subdirectories/files without whatever prompt?










      share|improve this question
















      I need to delete a whole directory (with a lot of sub directories and files) by running a command in a batch file.



      I tried delete and erase, but both of them requires me to answer 'Y/N', and it doesn't seem to delete the directories if one has subdirectories or files.



      What command can I use to delete a directory with subdirectories/files without whatever prompt?







      windows-7






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 10 '17 at 14:37









      djsmiley2k

      5,12612336




      5,12612336










      asked Oct 28 '10 at 16:05









      prosseekprosseek

      2,337154970




      2,337154970






















          3 Answers
          3






          active

          oldest

          votes


















          20














          rmdir /s /q [directory]





          share|improve this answer































            2














            Try:



            DEL /Q /S /F <FILE/DIR>


            or



            DELETE /Q /S /F <FILE/DIR>





            share|improve this answer































              1














              I'm not sure if it's a valid command in the W7 CLI, but back when DOS was still DOS, it was as simple as:



              deltree /y <dirname or path>





              share|improve this answer



















              • 2





                deltree is not supported in Win7.

                – prosseek
                Oct 28 '10 at 16:25











              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "3"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f204406%2fwhats-the-equivalent-to-rm-rf-with-windows-command%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              20














              rmdir /s /q [directory]





              share|improve this answer




























                20














                rmdir /s /q [directory]





                share|improve this answer


























                  20












                  20








                  20







                  rmdir /s /q [directory]





                  share|improve this answer













                  rmdir /s /q [directory]






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 28 '10 at 16:28









                  AndrewAndrew

                  37816




                  37816

























                      2














                      Try:



                      DEL /Q /S /F <FILE/DIR>


                      or



                      DELETE /Q /S /F <FILE/DIR>





                      share|improve this answer




























                        2














                        Try:



                        DEL /Q /S /F <FILE/DIR>


                        or



                        DELETE /Q /S /F <FILE/DIR>





                        share|improve this answer


























                          2












                          2








                          2







                          Try:



                          DEL /Q /S /F <FILE/DIR>


                          or



                          DELETE /Q /S /F <FILE/DIR>





                          share|improve this answer













                          Try:



                          DEL /Q /S /F <FILE/DIR>


                          or



                          DELETE /Q /S /F <FILE/DIR>






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Oct 28 '10 at 16:09









                          BloodPhiliaBloodPhilia

                          24.5k1474104




                          24.5k1474104























                              1














                              I'm not sure if it's a valid command in the W7 CLI, but back when DOS was still DOS, it was as simple as:



                              deltree /y <dirname or path>





                              share|improve this answer



















                              • 2





                                deltree is not supported in Win7.

                                – prosseek
                                Oct 28 '10 at 16:25
















                              1














                              I'm not sure if it's a valid command in the W7 CLI, but back when DOS was still DOS, it was as simple as:



                              deltree /y <dirname or path>





                              share|improve this answer



















                              • 2





                                deltree is not supported in Win7.

                                – prosseek
                                Oct 28 '10 at 16:25














                              1












                              1








                              1







                              I'm not sure if it's a valid command in the W7 CLI, but back when DOS was still DOS, it was as simple as:



                              deltree /y <dirname or path>





                              share|improve this answer













                              I'm not sure if it's a valid command in the W7 CLI, but back when DOS was still DOS, it was as simple as:



                              deltree /y <dirname or path>






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Oct 28 '10 at 16:21









                              Tristan RineerTristan Rineer

                              272




                              272








                              • 2





                                deltree is not supported in Win7.

                                – prosseek
                                Oct 28 '10 at 16:25














                              • 2





                                deltree is not supported in Win7.

                                – prosseek
                                Oct 28 '10 at 16:25








                              2




                              2





                              deltree is not supported in Win7.

                              – prosseek
                              Oct 28 '10 at 16:25





                              deltree is not supported in Win7.

                              – prosseek
                              Oct 28 '10 at 16:25


















                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Super User!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f204406%2fwhats-the-equivalent-to-rm-rf-with-windows-command%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Plaza Victoria

                              Puebla de Zaragoza

                              Musa