?
Solved

Launching Process

Posted on 2006-05-05
9
Medium Priority
?
288 Views
Last Modified: 2010-04-16
Hi,

I would like to launch a process from within my application, at present I am using the System.Diagnostics.Process class to launch the process. In addition, I am passing in any command line arguments using the second parameter of the start method, e.g. :

   System.Diagnostics.Process.Start(oTask.Command, oTask.Arguments);

This works fine for most things. However it doesnt seem to work when the target is specified in the same format as the target field within a Windows Shortcut, for example if the target path of the shortcut is:

Comms.exe WaitForExit=0

I pass this as:

      System.Diagnostics.Process.Start("Comms.exe","WaitForExit=0");

Any ideas?

Thanks

0
Comment
Question by:paulsidebottom
6 Comments
 
LVL 19

Accepted Solution

by:
Fahad Mukhtar earned 252 total points
ID: 16614518
         System.Diagnostics.Process p = new System.Diagnostics.Process();
                System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo();
                si.FileName = "notepad.exe";
                p.StartInfo = si;
                p.Start();
                p.WaitForExit();

you can use the si.arguments to pass arguments
0
 
LVL 3

Expert Comment

by:seazium
ID: 16615179
chk it out .., it will describe u better
http://www.codeproject.com/csharp/HowToLaunchProcess.asp

dZ..,
0
 
LVL 3

Expert Comment

by:seazium
ID: 16615202
another 1 .., little bit more brief

http://www.codeproject.com/csharp/LaunchProcess.asp

dZ..,
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 1

Author Comment

by:paulsidebottom
ID: 16616443
Thanks for the replies but as stated, I am already using the arguments property to pass command arguments.  It seems the problem may not originate from the use the of command arguments more the process equivalent of Windows "start in" property.

Does anyone know how the start in property can be specified for a process?

Thanks.
0
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 248 total points
ID: 16616506
0
 
LVL 1

Author Comment

by:paulsidebottom
ID: 16940398
Apologies, I forgot I posted this - yes I'm happy with the resolution. Thanks for your answers.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month16 days, 6 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question