Why is this bat file not returning to the calling bat file?











up vote
1
down vote

favorite












K:bin>type get_resolution.bat  
i_view.bat "%1" /info=info.txt
echo after get_resolution
type info.txt | find "Resolution"

K:bin>type i_view.bat
echo %*
echo %errorlevel%
echo after i_view

K:bin>get_resolution.bat input.jpg

K:bin>i_view.bat "input.jpg" /info=info.txt

K:bin>echo "input.jpg" /info=info.txt
"input.jpg" /info=info.txt

K:bin>echo 0
0

K:bin>echo after i_view
after i_view

K:bin>


Why no "after get_resolution"?










share|improve this question


























    up vote
    1
    down vote

    favorite












    K:bin>type get_resolution.bat  
    i_view.bat "%1" /info=info.txt
    echo after get_resolution
    type info.txt | find "Resolution"

    K:bin>type i_view.bat
    echo %*
    echo %errorlevel%
    echo after i_view

    K:bin>get_resolution.bat input.jpg

    K:bin>i_view.bat "input.jpg" /info=info.txt

    K:bin>echo "input.jpg" /info=info.txt
    "input.jpg" /info=info.txt

    K:bin>echo 0
    0

    K:bin>echo after i_view
    after i_view

    K:bin>


    Why no "after get_resolution"?










    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      K:bin>type get_resolution.bat  
      i_view.bat "%1" /info=info.txt
      echo after get_resolution
      type info.txt | find "Resolution"

      K:bin>type i_view.bat
      echo %*
      echo %errorlevel%
      echo after i_view

      K:bin>get_resolution.bat input.jpg

      K:bin>i_view.bat "input.jpg" /info=info.txt

      K:bin>echo "input.jpg" /info=info.txt
      "input.jpg" /info=info.txt

      K:bin>echo 0
      0

      K:bin>echo after i_view
      after i_view

      K:bin>


      Why no "after get_resolution"?










      share|improve this question













      K:bin>type get_resolution.bat  
      i_view.bat "%1" /info=info.txt
      echo after get_resolution
      type info.txt | find "Resolution"

      K:bin>type i_view.bat
      echo %*
      echo %errorlevel%
      echo after i_view

      K:bin>get_resolution.bat input.jpg

      K:bin>i_view.bat "input.jpg" /info=info.txt

      K:bin>echo "input.jpg" /info=info.txt
      "input.jpg" /info=info.txt

      K:bin>echo 0
      0

      K:bin>echo after i_view
      after i_view

      K:bin>


      Why no "after get_resolution"?







      windows-10






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 15 at 13:44









      Francky Leyn

      223




      223






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote













          Use the call command. Without using this command, the batch file will "replace" the current one.



          In your script, you'd put call i_view.bat "%1" /info=info.txt.



          cmd.exe /k is equivalent.





          Here's part of the help text from call /?.



          Calls one batch program from another.

          CALL [drive:][path]filename [batch-parameters]

          batch-parameters Specifies any command-line information required by the
          batch program.

          If Command Extensions are enabled CALL changes as follows:

          CALL command now accepts labels as the target of the CALL. The syntax
          is:

          CALL :label arguments

          A new batch file context is created with the specified arguments and
          control is passed to the statement after the label specified. You must
          "exit" twice by reaching the end of the batch script file twice. The
          first time you read the end, control will return to just after the CALL
          statement. The second time will exit the batch script. Type GOTO /?
          for a description of the GOTO :EOF extension that will allow you to
          "return" from a batch script.





          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',
            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%2f1375686%2fwhy-is-this-bat-file-not-returning-to-the-calling-bat-file%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote













            Use the call command. Without using this command, the batch file will "replace" the current one.



            In your script, you'd put call i_view.bat "%1" /info=info.txt.



            cmd.exe /k is equivalent.





            Here's part of the help text from call /?.



            Calls one batch program from another.

            CALL [drive:][path]filename [batch-parameters]

            batch-parameters Specifies any command-line information required by the
            batch program.

            If Command Extensions are enabled CALL changes as follows:

            CALL command now accepts labels as the target of the CALL. The syntax
            is:

            CALL :label arguments

            A new batch file context is created with the specified arguments and
            control is passed to the statement after the label specified. You must
            "exit" twice by reaching the end of the batch script file twice. The
            first time you read the end, control will return to just after the CALL
            statement. The second time will exit the batch script. Type GOTO /?
            for a description of the GOTO :EOF extension that will allow you to
            "return" from a batch script.





            share|improve this answer

























              up vote
              2
              down vote













              Use the call command. Without using this command, the batch file will "replace" the current one.



              In your script, you'd put call i_view.bat "%1" /info=info.txt.



              cmd.exe /k is equivalent.





              Here's part of the help text from call /?.



              Calls one batch program from another.

              CALL [drive:][path]filename [batch-parameters]

              batch-parameters Specifies any command-line information required by the
              batch program.

              If Command Extensions are enabled CALL changes as follows:

              CALL command now accepts labels as the target of the CALL. The syntax
              is:

              CALL :label arguments

              A new batch file context is created with the specified arguments and
              control is passed to the statement after the label specified. You must
              "exit" twice by reaching the end of the batch script file twice. The
              first time you read the end, control will return to just after the CALL
              statement. The second time will exit the batch script. Type GOTO /?
              for a description of the GOTO :EOF extension that will allow you to
              "return" from a batch script.





              share|improve this answer























                up vote
                2
                down vote










                up vote
                2
                down vote









                Use the call command. Without using this command, the batch file will "replace" the current one.



                In your script, you'd put call i_view.bat "%1" /info=info.txt.



                cmd.exe /k is equivalent.





                Here's part of the help text from call /?.



                Calls one batch program from another.

                CALL [drive:][path]filename [batch-parameters]

                batch-parameters Specifies any command-line information required by the
                batch program.

                If Command Extensions are enabled CALL changes as follows:

                CALL command now accepts labels as the target of the CALL. The syntax
                is:

                CALL :label arguments

                A new batch file context is created with the specified arguments and
                control is passed to the statement after the label specified. You must
                "exit" twice by reaching the end of the batch script file twice. The
                first time you read the end, control will return to just after the CALL
                statement. The second time will exit the batch script. Type GOTO /?
                for a description of the GOTO :EOF extension that will allow you to
                "return" from a batch script.





                share|improve this answer












                Use the call command. Without using this command, the batch file will "replace" the current one.



                In your script, you'd put call i_view.bat "%1" /info=info.txt.



                cmd.exe /k is equivalent.





                Here's part of the help text from call /?.



                Calls one batch program from another.

                CALL [drive:][path]filename [batch-parameters]

                batch-parameters Specifies any command-line information required by the
                batch program.

                If Command Extensions are enabled CALL changes as follows:

                CALL command now accepts labels as the target of the CALL. The syntax
                is:

                CALL :label arguments

                A new batch file context is created with the specified arguments and
                control is passed to the statement after the label specified. You must
                "exit" twice by reaching the end of the batch script file twice. The
                first time you read the end, control will return to just after the CALL
                statement. The second time will exit the batch script. Type GOTO /?
                for a description of the GOTO :EOF extension that will allow you to
                "return" from a batch script.






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 15 at 13:46









                LawrenceC

                58.4k10100178




                58.4k10100178






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1375686%2fwhy-is-this-bat-file-not-returning-to-the-calling-bat-file%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

                    In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

                    How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...