CLI Commands + Arguments are not executing correctly.
I`m working in the CLI commands in my Visual Studio C# application. This application does the interface with the Flash Programmer 2 (Texas Instruments Software to bootload the firmware in CC2560) using CLI ( Command-Line interface).
I checked some examples in StackOverflow, but I didn't have success to implement the solutions.
Steps of my application:
- Select the serial port
- Open the console
- execute the srfprog.exe
- execute the command line (srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin )
- Check if the programming was a success
My file is located in: D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe
When I execute this in my CMD (windows) the Prompt window shows
After this screen pop up I sent the commands to program the chip
srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin
This command will program and verify the code in the microcontroller CC2650 as show in the screenshot below:
The programming is perfect.
However when I run(Click the button - Load Firmware) my application open and close Shell window immediately. As shown in the figure below
My code is below:
private void button2_Click(object sender, EventArgs e)
{
System.Diagnostics.Process CC2650 = new System.Diagnostics.Process();
CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe";
CC2650.StartInfo.Arguments = "srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument
CC2650.StartInfo.UseShellExecute = false;
CC2650.StartInfo.RedirectStandardOutput = true;
CC2650.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
CC2650.StartInfo.CreateNoWindow = false; //not diplay a windows
CC2650.Start();
string output = CC2650.StandardOutput.ReadToEnd(); //The output result
CC2650.WaitForExit();
}
In this test I`m using the fixed COM port. Later I will select the port.
Why my software is falling and doesn`t load the firmware?
Thank you for your attention and time.
c# visual-studio-2017 command-line-interface
add a comment |
I`m working in the CLI commands in my Visual Studio C# application. This application does the interface with the Flash Programmer 2 (Texas Instruments Software to bootload the firmware in CC2560) using CLI ( Command-Line interface).
I checked some examples in StackOverflow, but I didn't have success to implement the solutions.
Steps of my application:
- Select the serial port
- Open the console
- execute the srfprog.exe
- execute the command line (srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin )
- Check if the programming was a success
My file is located in: D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe
When I execute this in my CMD (windows) the Prompt window shows
After this screen pop up I sent the commands to program the chip
srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin
This command will program and verify the code in the microcontroller CC2650 as show in the screenshot below:
The programming is perfect.
However when I run(Click the button - Load Firmware) my application open and close Shell window immediately. As shown in the figure below
My code is below:
private void button2_Click(object sender, EventArgs e)
{
System.Diagnostics.Process CC2650 = new System.Diagnostics.Process();
CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe";
CC2650.StartInfo.Arguments = "srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument
CC2650.StartInfo.UseShellExecute = false;
CC2650.StartInfo.RedirectStandardOutput = true;
CC2650.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
CC2650.StartInfo.CreateNoWindow = false; //not diplay a windows
CC2650.Start();
string output = CC2650.StandardOutput.ReadToEnd(); //The output result
CC2650.WaitForExit();
}
In this test I`m using the fixed COM port. Later I will select the port.
Why my software is falling and doesn`t load the firmware?
Thank you for your attention and time.
c# visual-studio-2017 command-line-interface
add a comment |
I`m working in the CLI commands in my Visual Studio C# application. This application does the interface with the Flash Programmer 2 (Texas Instruments Software to bootload the firmware in CC2560) using CLI ( Command-Line interface).
I checked some examples in StackOverflow, but I didn't have success to implement the solutions.
Steps of my application:
- Select the serial port
- Open the console
- execute the srfprog.exe
- execute the command line (srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin )
- Check if the programming was a success
My file is located in: D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe
When I execute this in my CMD (windows) the Prompt window shows
After this screen pop up I sent the commands to program the chip
srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin
This command will program and verify the code in the microcontroller CC2650 as show in the screenshot below:
The programming is perfect.
However when I run(Click the button - Load Firmware) my application open and close Shell window immediately. As shown in the figure below
My code is below:
private void button2_Click(object sender, EventArgs e)
{
System.Diagnostics.Process CC2650 = new System.Diagnostics.Process();
CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe";
CC2650.StartInfo.Arguments = "srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument
CC2650.StartInfo.UseShellExecute = false;
CC2650.StartInfo.RedirectStandardOutput = true;
CC2650.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
CC2650.StartInfo.CreateNoWindow = false; //not diplay a windows
CC2650.Start();
string output = CC2650.StandardOutput.ReadToEnd(); //The output result
CC2650.WaitForExit();
}
In this test I`m using the fixed COM port. Later I will select the port.
Why my software is falling and doesn`t load the firmware?
Thank you for your attention and time.
c# visual-studio-2017 command-line-interface
I`m working in the CLI commands in my Visual Studio C# application. This application does the interface with the Flash Programmer 2 (Texas Instruments Software to bootload the firmware in CC2560) using CLI ( Command-Line interface).
I checked some examples in StackOverflow, but I didn't have success to implement the solutions.
Steps of my application:
- Select the serial port
- Open the console
- execute the srfprog.exe
- execute the command line (srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin )
- Check if the programming was a success
My file is located in: D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe
When I execute this in my CMD (windows) the Prompt window shows
After this screen pop up I sent the commands to program the chip
srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin
This command will program and verify the code in the microcontroller CC2650 as show in the screenshot below:
The programming is perfect.
However when I run(Click the button - Load Firmware) my application open and close Shell window immediately. As shown in the figure below
My code is below:
private void button2_Click(object sender, EventArgs e)
{
System.Diagnostics.Process CC2650 = new System.Diagnostics.Process();
CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe";
CC2650.StartInfo.Arguments = "srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument
CC2650.StartInfo.UseShellExecute = false;
CC2650.StartInfo.RedirectStandardOutput = true;
CC2650.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
CC2650.StartInfo.CreateNoWindow = false; //not diplay a windows
CC2650.Start();
string output = CC2650.StandardOutput.ReadToEnd(); //The output result
CC2650.WaitForExit();
}
In this test I`m using the fixed COM port. Later I will select the port.
Why my software is falling and doesn`t load the firmware?
Thank you for your attention and time.
c# visual-studio-2017 command-line-interface
c# visual-studio-2017 command-line-interface
asked Nov 19 '18 at 18:47
Carlos MartinsCarlos Martins
111
111
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Your code seems to be doubling up on srfprog by including it in the arguments. Filename defines the executable and Arguments should just be the stuff that comes after the Filename.
CC2650.StartInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin";
Dear Deepak, I tried your suggestion and the software continue not working. The console pop up and close. I tried CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe"; CC2650.StartInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument
– Carlos Martins
Nov 20 '18 at 15:48
Deepak I tried: and CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2bin"; CC2650.StartInfo.Arguments = "srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument in the second test the C# shows a message error (System.ComponentModel.win32exception: 'Access is denied'.
– Carlos Martins
Nov 20 '18 at 15:48
I'm guessing based on the button click event that this is running on an ASP.NET application? Unfortunately I'm not an expert there, so you'll need to research either granting permissions to the ASPNET account, or having the application run under different credentials. If you dump your code into a new console application, you should be able to at least rule out a problem with the code, and that should direct where you research next
– Deepak
Nov 20 '18 at 17:42
add a comment |
As mentioned before you don't need to pass the program name again in the arguments. To inspect what is happening please use code below. It will read the output and the errors in an async approach so we can analyse the output while the srfprog.exe is running.
I don't have any C# compiler here so I could not test this code before writing here, maybe you will have to change something to make it work. Please try it and let my know what will be printed in your Visual Studio output console.
// Add "using System.Diagnostics;"
private void button2_Click(object sender, EventArgs e)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe";
startInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin";
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
Process process = new Process();
process.StartInfo = startInfo;
process.OutputDataReceived += new DataReceivedEventHandler(OutputHandler);
process.ErrorDataReceived += new DataReceivedEventHandler(OutputHandler);
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
}
static void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
{
Console.WriteLine(outLine.Data);
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53380887%2fcli-commands-arguments-are-not-executing-correctly%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your code seems to be doubling up on srfprog by including it in the arguments. Filename defines the executable and Arguments should just be the stuff that comes after the Filename.
CC2650.StartInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin";
Dear Deepak, I tried your suggestion and the software continue not working. The console pop up and close. I tried CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe"; CC2650.StartInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument
– Carlos Martins
Nov 20 '18 at 15:48
Deepak I tried: and CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2bin"; CC2650.StartInfo.Arguments = "srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument in the second test the C# shows a message error (System.ComponentModel.win32exception: 'Access is denied'.
– Carlos Martins
Nov 20 '18 at 15:48
I'm guessing based on the button click event that this is running on an ASP.NET application? Unfortunately I'm not an expert there, so you'll need to research either granting permissions to the ASPNET account, or having the application run under different credentials. If you dump your code into a new console application, you should be able to at least rule out a problem with the code, and that should direct where you research next
– Deepak
Nov 20 '18 at 17:42
add a comment |
Your code seems to be doubling up on srfprog by including it in the arguments. Filename defines the executable and Arguments should just be the stuff that comes after the Filename.
CC2650.StartInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin";
Dear Deepak, I tried your suggestion and the software continue not working. The console pop up and close. I tried CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe"; CC2650.StartInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument
– Carlos Martins
Nov 20 '18 at 15:48
Deepak I tried: and CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2bin"; CC2650.StartInfo.Arguments = "srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument in the second test the C# shows a message error (System.ComponentModel.win32exception: 'Access is denied'.
– Carlos Martins
Nov 20 '18 at 15:48
I'm guessing based on the button click event that this is running on an ASP.NET application? Unfortunately I'm not an expert there, so you'll need to research either granting permissions to the ASPNET account, or having the application run under different credentials. If you dump your code into a new console application, you should be able to at least rule out a problem with the code, and that should direct where you research next
– Deepak
Nov 20 '18 at 17:42
add a comment |
Your code seems to be doubling up on srfprog by including it in the arguments. Filename defines the executable and Arguments should just be the stuff that comes after the Filename.
CC2650.StartInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin";
Your code seems to be doubling up on srfprog by including it in the arguments. Filename defines the executable and Arguments should just be the stuff that comes after the Filename.
CC2650.StartInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin";
answered Nov 20 '18 at 1:51
DeepakDeepak
243
243
Dear Deepak, I tried your suggestion and the software continue not working. The console pop up and close. I tried CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe"; CC2650.StartInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument
– Carlos Martins
Nov 20 '18 at 15:48
Deepak I tried: and CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2bin"; CC2650.StartInfo.Arguments = "srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument in the second test the C# shows a message error (System.ComponentModel.win32exception: 'Access is denied'.
– Carlos Martins
Nov 20 '18 at 15:48
I'm guessing based on the button click event that this is running on an ASP.NET application? Unfortunately I'm not an expert there, so you'll need to research either granting permissions to the ASPNET account, or having the application run under different credentials. If you dump your code into a new console application, you should be able to at least rule out a problem with the code, and that should direct where you research next
– Deepak
Nov 20 '18 at 17:42
add a comment |
Dear Deepak, I tried your suggestion and the software continue not working. The console pop up and close. I tried CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe"; CC2650.StartInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument
– Carlos Martins
Nov 20 '18 at 15:48
Deepak I tried: and CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2bin"; CC2650.StartInfo.Arguments = "srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument in the second test the C# shows a message error (System.ComponentModel.win32exception: 'Access is denied'.
– Carlos Martins
Nov 20 '18 at 15:48
I'm guessing based on the button click event that this is running on an ASP.NET application? Unfortunately I'm not an expert there, so you'll need to research either granting permissions to the ASPNET account, or having the application run under different credentials. If you dump your code into a new console application, you should be able to at least rule out a problem with the code, and that should direct where you research next
– Deepak
Nov 20 '18 at 17:42
Dear Deepak, I tried your suggestion and the software continue not working. The console pop up and close. I tried CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe"; CC2650.StartInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument
– Carlos Martins
Nov 20 '18 at 15:48
Dear Deepak, I tried your suggestion and the software continue not working. The console pop up and close. I tried CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe"; CC2650.StartInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument
– Carlos Martins
Nov 20 '18 at 15:48
Deepak I tried: and CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2bin"; CC2650.StartInfo.Arguments = "srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument in the second test the C# shows a message error (System.ComponentModel.win32exception: 'Access is denied'.
– Carlos Martins
Nov 20 '18 at 15:48
Deepak I tried: and CC2650.StartInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2bin"; CC2650.StartInfo.Arguments = "srfprog -t soc(COM84,CC2650) -e -p -v -f c:test.bin"; //argument in the second test the C# shows a message error (System.ComponentModel.win32exception: 'Access is denied'.
– Carlos Martins
Nov 20 '18 at 15:48
I'm guessing based on the button click event that this is running on an ASP.NET application? Unfortunately I'm not an expert there, so you'll need to research either granting permissions to the ASPNET account, or having the application run under different credentials. If you dump your code into a new console application, you should be able to at least rule out a problem with the code, and that should direct where you research next
– Deepak
Nov 20 '18 at 17:42
I'm guessing based on the button click event that this is running on an ASP.NET application? Unfortunately I'm not an expert there, so you'll need to research either granting permissions to the ASPNET account, or having the application run under different credentials. If you dump your code into a new console application, you should be able to at least rule out a problem with the code, and that should direct where you research next
– Deepak
Nov 20 '18 at 17:42
add a comment |
As mentioned before you don't need to pass the program name again in the arguments. To inspect what is happening please use code below. It will read the output and the errors in an async approach so we can analyse the output while the srfprog.exe is running.
I don't have any C# compiler here so I could not test this code before writing here, maybe you will have to change something to make it work. Please try it and let my know what will be printed in your Visual Studio output console.
// Add "using System.Diagnostics;"
private void button2_Click(object sender, EventArgs e)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe";
startInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin";
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
Process process = new Process();
process.StartInfo = startInfo;
process.OutputDataReceived += new DataReceivedEventHandler(OutputHandler);
process.ErrorDataReceived += new DataReceivedEventHandler(OutputHandler);
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
}
static void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
{
Console.WriteLine(outLine.Data);
}
add a comment |
As mentioned before you don't need to pass the program name again in the arguments. To inspect what is happening please use code below. It will read the output and the errors in an async approach so we can analyse the output while the srfprog.exe is running.
I don't have any C# compiler here so I could not test this code before writing here, maybe you will have to change something to make it work. Please try it and let my know what will be printed in your Visual Studio output console.
// Add "using System.Diagnostics;"
private void button2_Click(object sender, EventArgs e)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe";
startInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin";
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
Process process = new Process();
process.StartInfo = startInfo;
process.OutputDataReceived += new DataReceivedEventHandler(OutputHandler);
process.ErrorDataReceived += new DataReceivedEventHandler(OutputHandler);
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
}
static void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
{
Console.WriteLine(outLine.Data);
}
add a comment |
As mentioned before you don't need to pass the program name again in the arguments. To inspect what is happening please use code below. It will read the output and the errors in an async approach so we can analyse the output while the srfprog.exe is running.
I don't have any C# compiler here so I could not test this code before writing here, maybe you will have to change something to make it work. Please try it and let my know what will be printed in your Visual Studio output console.
// Add "using System.Diagnostics;"
private void button2_Click(object sender, EventArgs e)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe";
startInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin";
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
Process process = new Process();
process.StartInfo = startInfo;
process.OutputDataReceived += new DataReceivedEventHandler(OutputHandler);
process.ErrorDataReceived += new DataReceivedEventHandler(OutputHandler);
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
}
static void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
{
Console.WriteLine(outLine.Data);
}
As mentioned before you don't need to pass the program name again in the arguments. To inspect what is happening please use code below. It will read the output and the errors in an async approach so we can analyse the output while the srfprog.exe is running.
I don't have any C# compiler here so I could not test this code before writing here, maybe you will have to change something to make it work. Please try it and let my know what will be printed in your Visual Studio output console.
// Add "using System.Diagnostics;"
private void button2_Click(object sender, EventArgs e)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = @"D:ProjectsTest_FixtureTest_Fixture_Visual_StudioSmartRF ToolsFlash Programmer 2binsrfprog.exe";
startInfo.Arguments = "-t soc(COM84,CC2650) -e -p -v -f c:test.bin";
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
Process process = new Process();
process.StartInfo = startInfo;
process.OutputDataReceived += new DataReceivedEventHandler(OutputHandler);
process.ErrorDataReceived += new DataReceivedEventHandler(OutputHandler);
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
}
static void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
{
Console.WriteLine(outLine.Data);
}
edited Nov 21 '18 at 2:16
answered Nov 21 '18 at 2:06


Alexander SilvaAlexander Silva
11
11
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53380887%2fcli-commands-arguments-are-not-executing-correctly%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown