Hi all,
I have an exe MCP2210CLI placed at C:\Users\testuser\Desktop. I cannot run it directly by double clicking on it. So I use command prompt and execute the following.
C:\Users\testuser>cd desktop
C:\Users\testuser\Desktop>MCP2210CLI -devices
No devices connected.
I want to do these tasks in my c# code and generate the output in a command prompt.
I have written the following code. Howevwe an empty command prompt window opens. What change is needed in my code to get the exe running?
Process myProcess = new Process();
try
{
myProcess.StartInfo.FileName = @"C:\Users\testuser\Desktop\MCP2210CLI.exe";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.StartInfo.Arguments = "-devices";
myProcess.Start();
myProcess.WaitForExit();
}
catch (Exception e)
{
Console.WriteLine("error",e.Message);
}
Thanks in advance.
Loading
D SkPosted Jul 26, 2017, 4:32 AM
@echo off
title SimpleEXE
echo Started Batch File
cd "C:\Users\testuser\Desktop"
CALL MCP2210CLI.exe -devices 1>stdout.txt
CALL MCP2210CLI.exe -devices>>file.txt
echo Trial EXE file 3
pause
If I replace CALL by START command,i do not get any output. Only wen I use CALL command I get the output printed on the command promt.
I want to write this in my c# code. kindly help me out.