Why doesn't this batch command work as expected?Understanding an application's cmd argumentsRedirecting...

How should I handle players who ignore the session zero agreement?

Finding a logistic regression model which can achieve zero error on a training set training data for a binary classification problem with two features

What is the data structure of $@ in shell?

Why publish a research paper when a blog post or a lecture slide can have more citation count than a journal paper?

Is using an 'empty' metaphor considered bad style?

Has any human ever had the choice to leave Earth permanently?

Why is Agricola named as such?

A starship is travelling at 0.9c and collides with a small rock. Will it leave a clean hole through, or will more happen?

Use two 8s and two 3s to make the number 24

What would be the rarity of this magic item(s)?

What does it mean for a caliber to be flat shooting?

Quickly creating a sparse array

Am I a Rude Number?

Is there a feather fall weight limit?

What is the purpose of easy combat scenarios that don't need resource expenditure?

What would the chemical name be for C13H8Cl3NO

Can you tell from a blurry photo if focus was too close or too far?

Can I make estimated tax payments instead of withholding from my paycheck?

What are the exceptions to Natural Selection?

Increment each digit in a number to form a new number

Why do cars have plastic shrouds over the engine?

Increasing the flow in descriptions of a sequence of events

Eww, those bytes are gross

Should I reinstall Linux when changing the laptop's CPU?



Why doesn't this batch command work as expected?


Understanding an application's cmd argumentsRedirecting Shutdown.exe errors to fileWindows cmd: escape commands to start cmd from batch file, executing commands that add to PATHControlling encoding of redirected win console command outputBatch script to list all files on diskThe “+” and “-” signs next to the job numberWhy this multiline for/in/do doesn't work in a batch?How to loop through files named in a text file? Windows Server 2012Error level always 0 in batch fileBad number error with Linux float variable value comparison operator condition













0















Here are the commands I enter on the Windows command line:



> set /P myvalue="Enter a value: " && echo "Here is what you entered: %myvalue%"



I was expecting that this script would assign user input to %myvalue%, and (upon successful exit from the first command) would output %myvalue% as per the echo command. The echo statement is not outputting the current value of %myvalue%.



If I run the commands separately, and consecutively, I get the expected behavior.



Why?









share







New contributor




ggg123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    Here are the commands I enter on the Windows command line:



    > set /P myvalue="Enter a value: " && echo "Here is what you entered: %myvalue%"



    I was expecting that this script would assign user input to %myvalue%, and (upon successful exit from the first command) would output %myvalue% as per the echo command. The echo statement is not outputting the current value of %myvalue%.



    If I run the commands separately, and consecutively, I get the expected behavior.



    Why?









    share







    New contributor




    ggg123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      Here are the commands I enter on the Windows command line:



      > set /P myvalue="Enter a value: " && echo "Here is what you entered: %myvalue%"



      I was expecting that this script would assign user input to %myvalue%, and (upon successful exit from the first command) would output %myvalue% as per the echo command. The echo statement is not outputting the current value of %myvalue%.



      If I run the commands separately, and consecutively, I get the expected behavior.



      Why?









      share







      New contributor




      ggg123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      Here are the commands I enter on the Windows command line:



      > set /P myvalue="Enter a value: " && echo "Here is what you entered: %myvalue%"



      I was expecting that this script would assign user input to %myvalue%, and (upon successful exit from the first command) would output %myvalue% as per the echo command. The echo statement is not outputting the current value of %myvalue%.



      If I run the commands separately, and consecutively, I get the expected behavior.



      Why?







      windows-10 command-line batch





      share







      New contributor




      ggg123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      ggg123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      ggg123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 8 mins ago









      ggg123ggg123

      11




      11




      New contributor




      ggg123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      ggg123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      ggg123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          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
          });


          }
          });






          ggg123 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1410032%2fwhy-doesnt-this-batch-command-work-as-expected%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          ggg123 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          ggg123 is a new contributor. Be nice, and check out our Code of Conduct.













          ggg123 is a new contributor. Be nice, and check out our Code of Conduct.












          ggg123 is a new contributor. Be nice, and check out our Code of Conduct.
















          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%2f1410032%2fwhy-doesnt-this-batch-command-work-as-expected%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

          VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

          Tribunal Administrativo e Fiscal de Mirandela Referências Menu de...

          looking for continuous Screen Capture for retroactivly reproducing errors, timeback machineRolling desktop...