I am trying to run this command from command-line prompt:
"D:\\fiji\\fiji.exe -macro D:\\fiji\\macros\\FFTBatch.ijm --headless"
It works perfect when I type it in a command-line console.
However, when I was trying to make it work from C# application, it failed. I tried following, but seems the command above did not get executed somehow:
string fijiCmdText = "D:\\fiji\\fiji.exe -macro D:\\fiji\\macros\\FFTBatch.ijm --headless";
System.Diagnostics.Process.Start("cmd.exe", fijiCmdText);
Anyone has any idea how to change it to work? Thanks.
The problem was solved as in the direction Chris Haas pointed out. It does not mean other answers don't work, it just means the problem can be solved at least in one way.
Here it is, simply adding
"/C "
in the code, and it should work:Original that did not work:
;
Current code that works:
Here is the reference mentioned by Chris Haas. See EDIT3
You don't have to run cmd.exe, just create
ProcessStartInfo
object and pass the command with its parameters to it. Like this:Here is an example that shows you how to do it:
So in your case, this is your command:
"D:\\fiji\\fiji.exe"
and this is your command parameters or arguments:@"-macro D:\\fiji\\macros\\FFTBatch.ijm --headless"
Try This: