Remove quotes in Forfiles output {cmd}












3















So I am running this command:



FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"


and the output:



"058-26174-078"



but the problem is that I want the name without the quotations



like this: 058-26174-078










share|improve this question





























    3















    So I am running this command:



    FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"


    and the output:



    "058-26174-078"



    but the problem is that I want the name without the quotations



    like this: 058-26174-078










    share|improve this question



























      3












      3








      3








      So I am running this command:



      FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"


      and the output:



      "058-26174-078"



      but the problem is that I want the name without the quotations



      like this: 058-26174-078










      share|improve this question
















      So I am running this command:



      FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"


      and the output:



      "058-26174-078"



      but the problem is that I want the name without the quotations



      like this: 058-26174-078







      windows command-line cmd.exe






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 15 '16 at 16:53









      DavidPostill

      108k27235270




      108k27235270










      asked Jan 15 '16 at 14:42









      Hacker DudeHacker Dude

      1614




      1614






















          2 Answers
          2






          active

          oldest

          votes


















          2














          How do I remove the quotes from a variable in a cmd shell?



          You need to use ~ parameter extension together with for /f to do this.



          Use the following command:



          for /f %i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @echo %~i


          To set a variable, and in a batch file, use the following command:



          for /f %%i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @set MyVariable=%%~i


          Notes:





          • %~1 Expand %1 removing any surrounding quotes (")

          • In a batch file replace %i with %%i and %~i with %%~i




          Further Reading





          • An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.


          • parameters - A command line argument (or parameter) is any value passed into a batch script.






          share|improve this answer

































            0














            Use the for command, here is an example:



            @echo off
            FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 set quote=@fname"
            for %%a in (%quote%) do set dequote=%%~a


            And you can use the %dequote% variable to get the dequoted string, I may have got the syntax wrong because I have never worked with the forfiles command.






            share|improve this answer
























              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%2f1026785%2fremove-quotes-in-forfiles-output-cmd%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2














              How do I remove the quotes from a variable in a cmd shell?



              You need to use ~ parameter extension together with for /f to do this.



              Use the following command:



              for /f %i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @echo %~i


              To set a variable, and in a batch file, use the following command:



              for /f %%i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @set MyVariable=%%~i


              Notes:





              • %~1 Expand %1 removing any surrounding quotes (")

              • In a batch file replace %i with %%i and %~i with %%~i




              Further Reading





              • An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.


              • parameters - A command line argument (or parameter) is any value passed into a batch script.






              share|improve this answer






























                2














                How do I remove the quotes from a variable in a cmd shell?



                You need to use ~ parameter extension together with for /f to do this.



                Use the following command:



                for /f %i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @echo %~i


                To set a variable, and in a batch file, use the following command:



                for /f %%i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @set MyVariable=%%~i


                Notes:





                • %~1 Expand %1 removing any surrounding quotes (")

                • In a batch file replace %i with %%i and %~i with %%~i




                Further Reading





                • An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.


                • parameters - A command line argument (or parameter) is any value passed into a batch script.






                share|improve this answer




























                  2












                  2








                  2







                  How do I remove the quotes from a variable in a cmd shell?



                  You need to use ~ parameter extension together with for /f to do this.



                  Use the following command:



                  for /f %i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @echo %~i


                  To set a variable, and in a batch file, use the following command:



                  for /f %%i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @set MyVariable=%%~i


                  Notes:





                  • %~1 Expand %1 removing any surrounding quotes (")

                  • In a batch file replace %i with %%i and %~i with %%~i




                  Further Reading





                  • An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.


                  • parameters - A command line argument (or parameter) is any value passed into a batch script.






                  share|improve this answer















                  How do I remove the quotes from a variable in a cmd shell?



                  You need to use ~ parameter extension together with for /f to do this.



                  Use the following command:



                  for /f %i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @echo %~i


                  To set a variable, and in a batch file, use the following command:



                  for /f %%i in ('FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 echo @fname"') do @set MyVariable=%%~i


                  Notes:





                  • %~1 Expand %1 removing any surrounding quotes (")

                  • In a batch file replace %i with %%i and %~i with %%~i




                  Further Reading





                  • An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.


                  • parameters - A command line argument (or parameter) is any value passed into a batch script.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jan 16 '16 at 20:44

























                  answered Jan 15 '16 at 16:53









                  DavidPostillDavidPostill

                  108k27235270




                  108k27235270

























                      0














                      Use the for command, here is an example:



                      @echo off
                      FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 set quote=@fname"
                      for %%a in (%quote%) do set dequote=%%~a


                      And you can use the %dequote% variable to get the dequoted string, I may have got the syntax wrong because I have never worked with the forfiles command.






                      share|improve this answer




























                        0














                        Use the for command, here is an example:



                        @echo off
                        FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 set quote=@fname"
                        for %%a in (%quote%) do set dequote=%%~a


                        And you can use the %dequote% variable to get the dequoted string, I may have got the syntax wrong because I have never worked with the forfiles command.






                        share|improve this answer


























                          0












                          0








                          0







                          Use the for command, here is an example:



                          @echo off
                          FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 set quote=@fname"
                          for %%a in (%quote%) do set dequote=%%~a


                          And you can use the %dequote% variable to get the dequoted string, I may have got the syntax wrong because I have never worked with the forfiles command.






                          share|improve this answer













                          Use the for command, here is an example:



                          @echo off
                          FORFILES /S /M *.dmg /C "cmd /c if @fsize equ 1595694080 set quote=@fname"
                          for %%a in (%quote%) do set dequote=%%~a


                          And you can use the %dequote% variable to get the dequoted string, I may have got the syntax wrong because I have never worked with the forfiles command.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Feb 17 at 12:57









                          HayzHayz

                          111




                          111






























                              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%2f1026785%2fremove-quotes-in-forfiles-output-cmd%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

                              flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                              Mangá

                              Eduardo VII do Reino Unido