• Login
Community
  • Login

Command window closes automatically

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
runerrorproblemc++freefem++command windowexitoutputnotepad++ v8.7.8
6 Posts 2 Posters 271 Views
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.
  • F
    Fernando Fernandez Escalante
    last edited by Mar 25, 2025, 7:14 PM

    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++.

    P 1 Reply Last reply Mar 25, 2025, 7:25 PM Reply Quote 0
    • P
      PeterJones @Fernando Fernandez Escalante
      last edited by PeterJones Mar 25, 2025, 7:26 PM Mar 25, 2025, 7:25 PM

      @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

      F 1 Reply Last reply Mar 25, 2025, 7:55 PM Reply Quote 2
      • F
        Fernando Fernandez Escalante @PeterJones
        last edited by Mar 25, 2025, 7:55 PM

        @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.

        F 1 Reply Last reply Mar 25, 2025, 8:33 PM Reply Quote 0
        • F
          Fernando Fernandez Escalante @Fernando Fernandez Escalante
          last edited by Mar 25, 2025, 8:33 PM

          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.

          P 1 Reply Last reply Mar 25, 2025, 9:25 PM Reply Quote 1
          • P
            PeterJones @Fernando Fernandez Escalante
            last edited by Mar 25, 2025, 9:25 PM

            @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.

            F 1 Reply Last reply Mar 25, 2025, 9:36 PM Reply Quote 1
            • F
              Fernando Fernandez Escalante @PeterJones
              last edited by Mar 25, 2025, 9:36 PM

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

              1 Reply Last reply Reply Quote 1
              5 out of 6
              • First post
                5/6
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors