Keeping console window open after error in haskell executable - windows

How do stop the console window from closing after there has been a error when running a .exe?
I am keeping the window open with _ <- getLine but this of course only works if the program runs up to that point.

If you are asking how to keep the console window opened when invoked from a short cut, try invoking the program with cmd.exe /k ...
See, for instance: How do you keep the console from closing after the program is done in C?

Related

Closing a new console window started from a batch script prompts to terminate the script

I'm trying to make a batch script for running multiple command line antivirus scans in a specific order.
I use it this way:
echo Running Sophos virus scan...
start "Sophos Scan" /wait /d "%~dp0sophos" SVRTcli.exe -yes >>%~dp0logs\sophoslog.txt
This will popup a new console window running sophos and wait till it's done.
If I close the new console window, the main window of my batch file will prompt for terminating the batch script. I want to avoid it and just automatically continue with my next command which is similar to the previous (different anti virus engine).
Is it possible? I tried with various solutions on the net. Every time it's the same result. You close the new console and it comes up on your batch cmd.

Keep Windows command window open

I'm running a command through the Windows shell- an existing command window (cmd.exe). When I execute the command, the window closes, even though it's a freestanding window not tied to the command.
How can I keep the window open to see the output?
You can't simply start a child cmd session because it'll share same window and if your custom tool actively closes its window (I wonder why) then it'll close your console and output will disappear.
There isn't much you can do if a program want to close console window but you can at least save its output to a file (to be inspected later with type). If you're working with that console and you don't want to close it then you can use start cmd to execute it in a new console window. Like this:
start cmd /c tool -args ^> output.txt
tool output will be available in output.txt after it finished.
It appears that the executable is closing the command window. Here is what you could try, may work. open a command shell. In the shell issue "cmd" and open another command shell. Run your executable in the newly opened command shell. You nested cmd will be exited, but you may still be able to see some of the output of your executable.

Close the command prompt window programmatically

I have a set of commands in batch file which is used to run the JAR file.It is working perfectly.
After running the program, the command prompt window doesn't get closed. If I manually close the window, then the application closes as well.
So I want to close the command window without affecting the application.
thanks in advance.
Either use exit or make a new method to go to and have nothing in it. The exit way is better though. :)
My psychic debugging powers tell me you're launching the JAR file using a java command instead of a javaw command.
Use javaw instead and the command window will close when the batch file exits.

Preventing nosetests from closing in Windows

I'm running Windows 7 and am trying to run nosetests.
It's been installed and I can run it successfully, except that when I do run it (by typing 'nosetests' in the cmd window), it'll open a new cmd window with the output - but this window closes before I can see what it says. How do I prevent the results from closing so I can see them?
I'm a real n00b, in case you hadn't noticed.

Stop vim from flashing command prompt in Windows?

Vim under win32 opens a command prompt (vimrun.exe actually, which opens in a terminal window) on every external command, silent or not. Yes, the terminal closes automatically, but it is still quite annoying.
This makes plugins that make extensive use of external commands, such as syntastic (it runs a command on buffer open/save), a real pain.
Is there some way to fix this behavior? What I want is for the terminal to open only for non-silent commands.
Rather than just ![windows command] you might try:
!start /min [windows command]
Alternatively, if you define a shortcut to a windows app you can click on the shortcut's properties and set it up to run as 'Minimized' rather than as 'Normal'
In both cases above an app button will show up on taskbar as the app is opened, as there would be for any minimized application. But it's less intrusive than having an actual window open.
NOTE The !start command solution runs the command asynchronously, resumes Vim immediately without waiting for the command to complete, which may often not be what you want. In that case the use of shortcut set up to run as minimized is better solution.
Just to bring closure: I wrote a replacement runner utility for Vim on Windows that doesn't open a visible command prompt. Here it is: vimrun-silent.

Resources