473,494 Members | 2,223 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Starting application like: C:\Direct -a -b -c <C:\Script.src > C:\log.txt

Hi,

how can I start new process with this kind of application ?

C:\Direct.exe -a -b -c <C:\Script.src C:\log.txt

As you can see...I'll start appliaction ConnectDirect with 5 paramaters

-a = node
-b = username
-c = password

C:\Script.src = input file with script
C:\Log.txt = output file of direct.exe application

How can I start that application with using of Process class ?
There's a problem when I try to start it with this code - it doesnt work :-(

StringBuilder args1 = new StringBuilder();
args1.Append("-n" + localhost + " -u" + userName + " -p" +
password + " ");

Process myProcess = new Process();

myProcess.StartInfo.FileName = cdHome + "Direct.exe";

myProcess.StartInfo.Arguments = args1.ToString();

myProcess.StartInfo.UseShellExecute = false;

myProcess.StartInfo.RedirectStandardInput = true;

myProcess.StartInfo.RedirectStandardError = true;

myProcess.StartInfo.RedirectStandardOutput = true;

myProcess.Start();

// input

StreamWriter myStreamWriter = myProcess.StandardInput;

string[] procedData = File.ReadAllLines(prozessFile);

for (int i = 0; i < procedData.Length; i++)

{

myStreamWriter.WriteLine(procedData[i]);

}

myStreamWriter.Close();

string output = myProcess.StandardOutput.ReadToEnd();
File.WriteAllText(temp + "StdOutLog.txt", output);

// error output z aplikace

string outputErr = myProcess.StandardError.ReadToEnd();

File.WriteAllText(temp + "StdErrorLog.txt", outputErr);

Is there some posibility to start it ? Mayby with CMD /c ??

Thx for any help or information
Nov 17 '06 #1
1 2839
Hello SMichal,

You need to pass ProcessInfo object to Process to pass arguments

see http://msdn.microsoft.com/msdnmag/is...09/NETMatters/

Hi,

how can I start new process with this kind of application ?

C:\Direct.exe -a -b -c <C:\Script.src C:\log.txt

As you can see...I'll start appliaction ConnectDirect with 5
paramaters

-a = node
-b = username
-c = password
C:\Script.src = input file with script
C:\Log.txt = output file of direct.exe application
How can I start that application with using of Process class ? There's
a problem when I try to start it with this code - it doesnt work :-(

StringBuilder args1 = new StringBuilder();
args1.Append("-n" + localhost + " -u" + userName + "
-p" +
password + " ");
Process myProcess = new Process();

myProcess.StartInfo.FileName = cdHome + "Direct.exe";

myProcess.StartInfo.Arguments = args1.ToString();

myProcess.StartInfo.UseShellExecute = false;

myProcess.StartInfo.RedirectStandardInput = true;

myProcess.StartInfo.RedirectStandardError = true;

myProcess.StartInfo.RedirectStandardOutput = true;

myProcess.Start();

// input

StreamWriter myStreamWriter = myProcess.StandardInput;

string[] procedData = File.ReadAllLines(prozessFile);

for (int i = 0; i < procedData.Length; i++)

{

myStreamWriter.WriteLine(procedData[i]);

}

myStreamWriter.Close();

string output = myProcess.StandardOutput.ReadToEnd();
File.WriteAllText(temp + "StdOutLog.txt", output);
// error output z aplikace

string outputErr =
myProcess.StandardError.ReadToEnd();

File.WriteAllText(temp + "StdErrorLog.txt",
outputErr);

Is there some posibility to start it ? Mayby with CMD /c ??

Thx for any help or information

Nov 17 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
300
by: Lakshmikanth | last post by:
Hi, In my web application, i have coded to log an entry in application log, if any error occurs on any page. It works fine with NTLM Authentication and custom error mode is set to "Off" in...
9
7353
by: Mike | last post by:
How do I prevent SQL Server 2000 from posting successful backup completion messages to the Windows 2000 Application Event Log? I have scheduled jobs which backup my transaction logs on 50+...
1
3029
by: Next | last post by:
Hello, This code writes to the Application log. Isn't it suppose to write to "NewLog" log? I'm not getting something here. Can someone help? Thanks in advance, Aaron
2
9314
by: Russell Thomas | last post by:
I've been working with the My.Application.Log.WriteEntry method in VB.net 2005 and when it writes a log is stores the log file in the application data folder under the systems user account. I have...
21
8486
by: hemant.singh | last post by:
Hello all, I am try'g to send window.location.href to the server script who will generate dynamic javascript according to the referral name comg in as param Now bcz <script language="javascript"...
1
2997
by: MattB | last post by:
Hi. I need to start logging my application in the Windows Event Log. I found some sample code and it works from a Windows Form. So I put it into my asp.net application and initially had a problem...
3
6113
by: Dachshund Digital | last post by:
Has any one figured out how to override the WriteEntry or show change the actual output? I am sorry, but putting the DATE/TIME PROCESS # and Thread # information AFTER the 'Message' text just...
12
6029
by: Martyn Fewtrell | last post by:
Hi there I'm trying to find the correct way to write exceptions to the Application log using Vb.Net. I've done a fair bit of Googleing and although this gets plenty of mentions and that this...
0
3590
by: David Lozzi | last post by:
Howdy, I'm working on some error handling for my application. Currently on WinXP Pro SP2. Basically this is what I'm doing: Try...Catch at the method level, Catch sends email with error ...
0
725
by: Sid Price | last post by:
I have created and included a app.config file in my solution; I need to have an event log for my client's applications and services. The application installer creates a logfile using the clients...
0
7119
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6989
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7195
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7367
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4889
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1400
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
285
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.