Set placeholder command in cmd at start shell without executing the command automatically [duplicate]












0
















This question already has an answer here:




  • How can I run cmd from batch file and add text to line without executing?

    4 answers




I want to open a cmd shell and set some command in the promt without executing them. The goal is: Shell opens with command (e.g. echo hello) and the user only need to press enter instead of typing it.



Is this possible? I found the /k switch like cmd /k echo hello but this executes the command immediately. The only workaround I see is something like cmd /k "pause && echo hello" but this is not very transparent as the user doesn't know what got executed.










share|improve this question













marked as duplicate by Squashman, Aacini batch-file
Users with the  batch-file badge can single-handedly close batch-file questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 16 '18 at 14:38


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.























    0
















    This question already has an answer here:




    • How can I run cmd from batch file and add text to line without executing?

      4 answers




    I want to open a cmd shell and set some command in the promt without executing them. The goal is: Shell opens with command (e.g. echo hello) and the user only need to press enter instead of typing it.



    Is this possible? I found the /k switch like cmd /k echo hello but this executes the command immediately. The only workaround I see is something like cmd /k "pause && echo hello" but this is not very transparent as the user doesn't know what got executed.










    share|improve this question













    marked as duplicate by Squashman, Aacini batch-file
    Users with the  batch-file badge can single-handedly close batch-file questions as duplicates and reopen them as needed.

    StackExchange.ready(function() {
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function() {
    $hover.showInfoMessage('', {
    messageElement: $msg.clone().show(),
    transient: false,
    position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
    dismissable: false,
    relativeToBody: true
    });
    },
    function() {
    StackExchange.helpers.removeMessages();
    }
    );
    });
    });
    Nov 16 '18 at 14:38


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





















      0












      0








      0









      This question already has an answer here:




      • How can I run cmd from batch file and add text to line without executing?

        4 answers




      I want to open a cmd shell and set some command in the promt without executing them. The goal is: Shell opens with command (e.g. echo hello) and the user only need to press enter instead of typing it.



      Is this possible? I found the /k switch like cmd /k echo hello but this executes the command immediately. The only workaround I see is something like cmd /k "pause && echo hello" but this is not very transparent as the user doesn't know what got executed.










      share|improve this question















      This question already has an answer here:




      • How can I run cmd from batch file and add text to line without executing?

        4 answers




      I want to open a cmd shell and set some command in the promt without executing them. The goal is: Shell opens with command (e.g. echo hello) and the user only need to press enter instead of typing it.



      Is this possible? I found the /k switch like cmd /k echo hello but this executes the command immediately. The only workaround I see is something like cmd /k "pause && echo hello" but this is not very transparent as the user doesn't know what got executed.





      This question already has an answer here:




      • How can I run cmd from batch file and add text to line without executing?

        4 answers








      batch-file cmd windows-10






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 16 '18 at 9:27









      DanielDaniel

      107111




      107111




      marked as duplicate by Squashman, Aacini batch-file
      Users with the  batch-file badge can single-handedly close batch-file questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Nov 16 '18 at 14:38


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









      marked as duplicate by Squashman, Aacini batch-file
      Users with the  batch-file badge can single-handedly close batch-file questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Nov 16 '18 at 14:38


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


























          1 Answer
          1






          active

          oldest

          votes


















          0














          So there are 2 ways of doing this:



          Create a shortcut.




          Right click in a folder where you want to store the shortcut



          Select new Shortcut



          In the command window, type the following:




          cmd /k echo press Enter to continue ping localhost command && pause >nul && ping localhost



          Click next and give it a name and save.




          Now you can double click the file and it will print to screen:



          press Enter to continue ping localhost command


          when Enter is pressed, it will ping localhost



          Batch File




          Open notepad.exe



          Type the following




          @echo off
          echo press Enter to continue ping localhost command
          pause >nul
          ping localhost
          pause



          Save the file to the desired location and give it a .cmd extension




          Now you can double click the file and it will do the same as the previously created shortcut version.



          As for transparency, if you want the use to see what will be running, you would need to show the user by echoing what will be done.. See the following example.



          @echo off
          echo echo hello
          pause >nul
          echo hello
          echo ping localhost
          pause >nul
          ping localhost
          pause..


          this only duplicates the actual commands as echo commands, hiding the actual command as well as the pause.



          Similarly with the shortcut version:



          cmd /k echo echo hello && pause >nul && echo hello && echo ping localhost && pause >nul && ping localhost





          share|improve this answer
































            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            So there are 2 ways of doing this:



            Create a shortcut.




            Right click in a folder where you want to store the shortcut



            Select new Shortcut



            In the command window, type the following:




            cmd /k echo press Enter to continue ping localhost command && pause >nul && ping localhost



            Click next and give it a name and save.




            Now you can double click the file and it will print to screen:



            press Enter to continue ping localhost command


            when Enter is pressed, it will ping localhost



            Batch File




            Open notepad.exe



            Type the following




            @echo off
            echo press Enter to continue ping localhost command
            pause >nul
            ping localhost
            pause



            Save the file to the desired location and give it a .cmd extension




            Now you can double click the file and it will do the same as the previously created shortcut version.



            As for transparency, if you want the use to see what will be running, you would need to show the user by echoing what will be done.. See the following example.



            @echo off
            echo echo hello
            pause >nul
            echo hello
            echo ping localhost
            pause >nul
            ping localhost
            pause..


            this only duplicates the actual commands as echo commands, hiding the actual command as well as the pause.



            Similarly with the shortcut version:



            cmd /k echo echo hello && pause >nul && echo hello && echo ping localhost && pause >nul && ping localhost





            share|improve this answer






























              0














              So there are 2 ways of doing this:



              Create a shortcut.




              Right click in a folder where you want to store the shortcut



              Select new Shortcut



              In the command window, type the following:




              cmd /k echo press Enter to continue ping localhost command && pause >nul && ping localhost



              Click next and give it a name and save.




              Now you can double click the file and it will print to screen:



              press Enter to continue ping localhost command


              when Enter is pressed, it will ping localhost



              Batch File




              Open notepad.exe



              Type the following




              @echo off
              echo press Enter to continue ping localhost command
              pause >nul
              ping localhost
              pause



              Save the file to the desired location and give it a .cmd extension




              Now you can double click the file and it will do the same as the previously created shortcut version.



              As for transparency, if you want the use to see what will be running, you would need to show the user by echoing what will be done.. See the following example.



              @echo off
              echo echo hello
              pause >nul
              echo hello
              echo ping localhost
              pause >nul
              ping localhost
              pause..


              this only duplicates the actual commands as echo commands, hiding the actual command as well as the pause.



              Similarly with the shortcut version:



              cmd /k echo echo hello && pause >nul && echo hello && echo ping localhost && pause >nul && ping localhost





              share|improve this answer




























                0












                0








                0







                So there are 2 ways of doing this:



                Create a shortcut.




                Right click in a folder where you want to store the shortcut



                Select new Shortcut



                In the command window, type the following:




                cmd /k echo press Enter to continue ping localhost command && pause >nul && ping localhost



                Click next and give it a name and save.




                Now you can double click the file and it will print to screen:



                press Enter to continue ping localhost command


                when Enter is pressed, it will ping localhost



                Batch File




                Open notepad.exe



                Type the following




                @echo off
                echo press Enter to continue ping localhost command
                pause >nul
                ping localhost
                pause



                Save the file to the desired location and give it a .cmd extension




                Now you can double click the file and it will do the same as the previously created shortcut version.



                As for transparency, if you want the use to see what will be running, you would need to show the user by echoing what will be done.. See the following example.



                @echo off
                echo echo hello
                pause >nul
                echo hello
                echo ping localhost
                pause >nul
                ping localhost
                pause..


                this only duplicates the actual commands as echo commands, hiding the actual command as well as the pause.



                Similarly with the shortcut version:



                cmd /k echo echo hello && pause >nul && echo hello && echo ping localhost && pause >nul && ping localhost





                share|improve this answer















                So there are 2 ways of doing this:



                Create a shortcut.




                Right click in a folder where you want to store the shortcut



                Select new Shortcut



                In the command window, type the following:




                cmd /k echo press Enter to continue ping localhost command && pause >nul && ping localhost



                Click next and give it a name and save.




                Now you can double click the file and it will print to screen:



                press Enter to continue ping localhost command


                when Enter is pressed, it will ping localhost



                Batch File




                Open notepad.exe



                Type the following




                @echo off
                echo press Enter to continue ping localhost command
                pause >nul
                ping localhost
                pause



                Save the file to the desired location and give it a .cmd extension




                Now you can double click the file and it will do the same as the previously created shortcut version.



                As for transparency, if you want the use to see what will be running, you would need to show the user by echoing what will be done.. See the following example.



                @echo off
                echo echo hello
                pause >nul
                echo hello
                echo ping localhost
                pause >nul
                ping localhost
                pause..


                this only duplicates the actual commands as echo commands, hiding the actual command as well as the pause.



                Similarly with the shortcut version:



                cmd /k echo echo hello && pause >nul && echo hello && echo ping localhost && pause >nul && ping localhost






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 16 '18 at 10:05

























                answered Nov 16 '18 at 9:49









                Gerhard BarnardGerhard Barnard

                9,23231233




                9,23231233

















                    Popular posts from this blog

                    Bressuire

                    Vorschmack

                    Quarantine