473,671 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.Diagnost ic.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.Diagnost ic.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 12053
From MSDN documentation

using System;
using System.Diagnost ics;
using System.Componen tModel;

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(m yFavoritesPath) ;

}

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

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

/// <summary>
/// Uses the ProcessStartInf o class to start new processes, both in
a minimized
/// mode.
/// </summary>
public void OpenWithStartIn fo()
{

ProcessStartInf o startInfo = new
ProcessStartInf o("IExplore.exe ");
startInfo.Windo wStyle = ProcessWindowSt yle.Minimized;

Process.Start(s tartInfo);

startInfo.Argum ents = "www.northwindt raders.com";

Process.Start(s tartInfo);

}

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

Environment.Get FolderPath(Envi ronment.Special Folder.Favorite s);

MyProcess myProcess = new MyProcess();

myProcess.OpenA pplication(myFa voritesPath);
myProcess.OpenW ithArguments();
myProcess.OpenW ithStartInfo();

}
}
}
--
-Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph
"adish11" <ad*****@walla. co.il> wrote in message
news:48******** *************** *******@localho st.talkaboutsof tware.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.Diagnost ic.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.Diagnost ics.ProcessStar tInfo startupInfo = new
System.Diagnost ics.ProcessStar tInfo();

startupInfo.Fil eName = "C:\\psexec.exe ";
startupInfo.Arg uments = "\\toc2";

startupInfo.Use ShellExecute = false;
startupInfo.Red irectStandardOu tput = true;
startupInfo.Red irectStandardEr ror = true;

System.Diagnost ics.Process process =
System.Diagnost ics.Process.Sta rt(startupInfo) ;

process.WaitFor Exit ();

Thanks

Nov 16 '05 #3

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

Similar topics

1
4499
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 contains information for the visualization and storage of the retrieved data. From mid july till now, i have made 4 different configuration sets and everything was fine. Today, i got the order to make a new configuration set. When the xml file was...
0
1188
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 with CopyTo(). Anyway - after that, this application have to start another one, so i do it with System.Diagnostic.Process.Start() <- where I bulid som sort of StartInfo. Every first time I run this application on new machne, this just started
5
1813
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 will not respond to tcp connections. The process is a service that accepts incoming tcp connections. Any ideas will be great.
0
1072
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 will not respond to tcp connections. The process is a service that accepts incoming tcp connections. Any ideas will be great.
5
2071
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 the c:\bin\xcacls starts nothing happens. How can I see output from the console i was trying to get the ProcessStartInfo.RedirectStandardOutput Property to work but even if I got the system to process it I didn;t know where the output was being...
1
5186
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 determine if the process was successful or if it failed. My shell command is: c:\cwrsync\rsync.exe -vvrtz --progress --include=*.prx I am calling the c:\cwrxync\rsync.exe and passing the
2
400
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 this. I just want the current process my app is running in and not other processes on the machine. Is there a way the above class can automatcally detect what process the code is running in?
6
6491
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 threads that are active. What would be the most reliable way to obtain this number? Thanks!
0
8474
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8392
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8912
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8819
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8669
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7428
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6222
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5692
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2809
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 we have to send another system

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.