Showing errors when program run from batch file crashes - command-line

I have a batch file (.bat) in Windows which I am using to run a program. The problem is sometimes the program crashes and I'd like to know when it does. If I double-click the program's .exe in an Explorer window and the program crashes (like if a .dll is missing) then I get a message like
The program can't start because XXXX.dll is missing from your computer. Try reinstalling the program to fix this problem.
But when I run the program through the .bat file, I don't get any indication that the program crashes - no popup, no output to the command line.
I'm guessing it has something to do with the .bat file absorbing the error message. For reference my .bat file looks like this (shortened to keep the post simple):
start directory\program.exe
I'd like to get an indication that the program has crashed. Is there something I can add to my .bat file to see that?

Using the start command creates a new command line window for program.exe to run in. That window closes immediately when program.exe exits, thereby hiding the error from you.
To fix it, simply change "start directory\program.exe" to "directory\program.exe"

Related

TCL/TK Wish can't find file in the same directory

I am trying to write a TCL/TK Script that accesses an INI File with the command [::ini::open DBW.ini]. I am using the inifile package for this and am trying to run on wish for the gui.
However, wish answers with "couldn't open "DBW.ini": no such file or directory". The odd thing about this is, that I can run this Code in the VSCode extension "Code Runner".
Code Runner is configured to access the same wish Compiler that I'm trying to run on my Windows System.
Why would I be able to run this Code through VSCode, but when im using the wish Compiler directly it throws an error message.
Thank you in advance
Most likely your Tcl code is not being executed in the same directory as where the DBW.ini file is. The Tcl command pwd will return the directory where the code is executing. If this is not where the ini file is, a simple fix would be to specify the whole path to the file when you try to open it, something like:
[::ini::open C:/some/where/DBW.ini]

Error in running MATLAB exe file within another program shows attempts to execute script as a function

I have an exe file created by deploytool of MATLAB. It is running successfully from command prompt or normally. But when I am trying to run it from another program, it is showing an error attempts to execute script as a function.
I am not passing any parameter in invocation of that exe file. When I closed the message window, another message window appeared - Error in mclFreeStackTrace.
I tried to run exe from using Batch file and instead of exe file, I executed Batch file from another program in which I was running exe file.
What is the problem with exe file.
Please help.
Thanks in advance..

rawr jruby creating exe

I've a very simple Ruby script, which I've used rawr to package up into a *.jar file. I can then run the *.jar file with java -jar *.jar. I would like to make my program into an executable so I did rake rawr:bundle:exe. It says that it successfully created an executable and I can see the executable it created.
What I don't understand is, when I double click the executable (or attempt to run it in the command prompt), it doesn't really do anything; it is supposed to display 'hello' and wait for me to push enter (on STDOUT) but nothing really happens. If I run the *.jar file, it displays 'hello'. How am I supposed to run the executable? I was expecting that when I double click the *.exe, that a command prompt window pop up displaying 'hello' and waiting for me to push enter...
Since the program displays to STDOUT, and doesn't have a GUI component, I think you need to run this from the command prompt. Not sure what OS your on, since you said .exe, I'm assuming windows. so you just need to run it from the command prompt instead of by double-clicking on it.
so in the same folder where you are able to succesfully execute:
java -jar *.jar
just type:
myApplication.exe
Or, if your in another location on the machine you can type:
C:\full\path\to\myApplication.exe
Otherwise, the process is just going to run in the background with no way for you to see the results.

how to execute c program in windows command prompt when run from eclipse cdt

I downloaded and configured eclipse cdt along with MinGW and able to compile c programs.
My question, how to start executing the program in command prompt when Run option clicked from eclipse. Currently it always executes the program in eclipse console.
Reason to have command prompt for executing c programs is to accept user inputs.
I would also like to know is there a way to accept user inputs when c program running in eclipse console.
Thanks in advance,
-Manju
I guess i am quite late but still you can try this out. You can execute c programs through Eclipse cdt by writing a batch file and calling them through a click of button or any other event handler. Just make sure you are in the correct directory before attempting to compile and execute the file.
You can find various resources online to create a batch file which can help you execute programs through the console.
On compiling the file, (if you haven't specified an output file), a.exe file will be created. To execute this file with command line inputs just type the following in cmd (as long as you are in the same directory)
a.exe "command line inputs"
where "command line inputs" are the inputs you want to provide to your program.
Hope this is helpful!
i know 8 years is very late,but maybe somone else like me see this,so my answer is :
you should use:
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
after every printf statment to be able to input data in eclipse ide console tab ,
as i understood :""The root cause of the I/O problem is that we're using Windows pipes to communicate with the underlying process. The pipes are buffered"
you can refer to this links for more informations;
http://wiki.eclipse.org/CDT/User/FAQ#Eclipse_console_does_not_show_output_on_Windows
https://bugs.eclipse.org/bugs/show_bug.cgi?id=173732

How to execute gdb script in eclipse when it attached?

I usually run a load libraries script when I attached to a process when I using eclipse.
I what it run this script automatically after I just attached to the process. But the .gdbinit script is executed at the beginning of attaching. Thus load libraries will fail in the .gdbinit script.
Is there a "ON_ATTACHED" function to let me do that?
I found the solution in another of my questions, I can write a .gdbinit script and define a post_run command.
How to redefine a gdb built-in command and call and call the original