Community
    • Login

    Command window closes automatically

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    runerrorproblemc++freefem++command windowexitoutputnotepad++ v8.7.8
    6 Posts 2 Posters 1.1k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Fernando Fernandez EscalanteF Offline
      Fernando Fernandez Escalante
      last edited by

      Hi, I’m having a problem using Freefem++ in Notepad++. The problem is that when I run my code, the command window opens and executes the code, but then closes automatically. If there’s an error or I want to see the result of a simple code, it won’t let me see it unless it has graphical output. I’ve been searching for a solution but haven’t found anything. Does anyone know a solution? I’m using the latest version of both Freefem++ and Notepad++.

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP Online
        PeterJones @Fernando Fernandez Escalante
        last edited by PeterJones

        @Fernando-Fernandez-Escalante ,

        When you use the Run > Run…, it opens that command in a cmd.exe window. cmd.exe’s default is to close the window when it’s done executing. if you want it to stay, you could change Run = REAL_COMMAND to cmd /k REAL_COMMAND (where REAL_COMMAND is the full content of your original Run) – but you’d have to manually close that window yourself. Or you could do something like cmd /c REAL_COMMAND && pause, so it will run REAL_COMMAND and then pause with “Press any key to continue…” – and so you can look at the output before continuing.

        Example: cmd /c echo hi && pause
        3909664a-fd1a-4121-9a12-1913aa2b02a4-image.png
        686d590c-cc33-4d70-bb88-fbacc1ebbe92-image.png

        Alternatively, instead of running from the Run > Run, you could use a plugin like NppExec to run the program, which would put the results in its console window embedded in Notepad++, rather than in an external cmd.exe terminal

        Fernando Fernandez EscalanteF 1 Reply Last reply Reply Quote 2
        • Fernando Fernandez EscalanteF Offline
          Fernando Fernandez Escalante @PeterJones
          last edited by

          @PeterJones Using cmd /k REAL_COMMAND was able to fix it. I also tried cmd /c REAL_COMMAND && pause, but it didn’t work; I’m not entirely sure why. But I can now see the command window and close it manually. Thank you very much for everything.

          Fernando Fernandez EscalanteF 1 Reply Last reply Reply Quote 0
          • Fernando Fernandez EscalanteF Offline
            Fernando Fernandez Escalante @Fernando Fernandez Escalante
            last edited by

            Okay, I just saw that the problem with cmd /c REAL_COMMAND && pause is that if the code has an error, it doesn’t reach the pause point and therefore closes automatically. I don’t know if there’s a solution, but I’m leaving it out in case anyone knows or has the same question.

            PeterJonesP 1 Reply Last reply Reply Quote 1
            • PeterJonesP Online
              PeterJones @Fernando Fernandez Escalante
              last edited by

              @Fernando-Fernandez-Escalante said in Command window closes automatically:

              I don’t know if there’s a solution

              Sorry, if you use a single & instead of a double &&, it should do the pause no matter what – I should have checked which was which before I gave the answer.

              Fernando Fernandez EscalanteF 1 Reply Last reply Reply Quote 1
              • Fernando Fernandez EscalanteF Offline
                Fernando Fernandez Escalante @PeterJones
                last edited by

                @PeterJones I just tried it and it works perfectly. Thanks again so much for the help.

                1 Reply Last reply Reply Quote 1

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors