473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

System.Diagnostic.Process

I'm using Web Application and want to execute an MSDOS executable with some
parameters like this example: software.exe -i -x

How do I use System.Diagnostic.Process to execute this .exe with
parameters? Could you give me the code lines with this example?

Thanks for your answer.
Nov 16 '05 #1
2 12013
From MSDN documentation

using System;
using System.Diagnostics;
using System.ComponentModel;

namespace MyProcessSample
{
/// <summary>
/// Shell for the sample.
/// </summary>
public class MyProcess
{

/// <summary>
/// Opens the Internet Explorer application.
/// </summary>
public void OpenApplication(string myFavoritesPath)
{
// Start Internet Explorer. Defaults to the home page.
Process.Start("IExplore.exe");

// Display the contents of the favorites folder in the browser.
Process.Start(myFavoritesPath);

}

/// <summary>
/// Opens urls and .html documents using Internet Explorer.
/// </summary>
public void OpenWithArguments()
{
// url's are not considered documents. They can only be opened
// by passing them as arguments.
Process.Start("IExplore.exe", "www.northwindtraders.com");

// Start a Web page using a browser associated with .html and
..asp files.
Process.Start("IExplore.exe", "C:\\myPath\\myFile.htm");
Process.Start("IExplore.exe", "C:\\myPath\\myFile.asp");
}

/// <summary>
/// Uses the ProcessStartInfo class to start new processes, both in
a minimized
/// mode.
/// </summary>
public void OpenWithStartInfo()
{

ProcessStartInfo startInfo = new
ProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Minimized;

Process.Start(startInfo);

startInfo.Arguments = "www.northwindtraders.com";

Process.Start(startInfo);

}

public static void Main()
{
// Get the path that stores favorite links.
string myFavoritesPath =

Environment.GetFolderPath(Environment.SpecialFolde r.Favorites);

MyProcess myProcess = new MyProcess();

myProcess.OpenApplication(myFavoritesPath);
myProcess.OpenWithArguments();
myProcess.OpenWithStartInfo();

}
}
}
--
-Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph
"adish11" <ad*****@walla.co.il> wrote in message
news:48******************************@localhost.ta lkaboutsoftware.com...
I'm using Web Application and want to execute an MSDOS executable with some parameters like this example: software.exe -i -x

How do I use System.Diagnostic.Process to execute this .exe with
parameters? Could you give me the code lines with this example?

Thanks for your answer.

Nov 16 '05 #2
Hi,
I have a WEB Apllication not Windows and trying to run psexec.exe file
with arguments. The file not responding to the call from the code. Please
check it, I really don't know where is the mistake and I don't know what
to do.

The code:
System.Diagnostics.ProcessStartInfo startupInfo = new
System.Diagnostics.ProcessStartInfo();

startupInfo.FileName = "C:\\psexec.exe";
startupInfo.Arguments = "\\toc2";

startupInfo.UseShellExecute = false;
startupInfo.RedirectStandardOutput = true;
startupInfo.RedirectStandardError = true;

System.Diagnostics.Process process =
System.Diagnostics.Process.Start(startupInfo);

process.WaitForExit ();

Thanks

Nov 16 '05 #3

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

Similar topics

1
by: Alex | last post by:
Hello, in my company, we have a diagnostic tool for hardware. Depending on the hardware projcet, a different project configuration is needed. The configuration file is written in XML and...
0
by: Stefan Turalski \(stic\) | last post by:
Hi, I need help with one thing - I've simple update application, it's chceck with FineInfo class if file in server has last write time > than file on my disc, if yes it is just update my file...
5
by: Michael Johnson Sr. | last post by:
I am starting and stopping a process using System.Diagnostic.Process. aspnet_wp is running as system rather than machine (as per machine.config modification). When the process gets started, it...
0
by: Michael Johnson Sr. | last post by:
I am starting and stopping a process using System.Diagnostic.Process. aspnet_wp is running as system rather than machine (as per machine.config modification). When the process gets started, it...
5
by: Paul Bergson | last post by:
I have been trying to get a process to start up and run with arguments passed to it. I have gotten close (Thanks to help from this board) but I there is a failure while I'm running this because...
1
by: brian | last post by:
I have a vb.net app using a shell command because I can't figure out how to use the string with the system.process.start. I would like to convert it so I can do a little error checking to...
2
by: Macca | last post by:
Hi, I would like to get the memory usage of the process my app is running in so i can monitor levels of memory during runtime. I've been told I can use the System.Diagnostics.Process class to do...
6
by: Gunga Din | last post by:
I must be missing it somehow... I need to count the number of threads running, not just those started by my application. Rather like the Task Manager, I would like to get the total number of...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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...

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.