Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / November 2007

Tip: Looking for answers? Try searching our database.

Trying to use Process.Start like CreateProcess

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ken Varn - 29 Oct 2007 21:17 GMT
The CreateProcess Win32 call will allow NULL to be passed for the
CommandLine setting.  When this is done, the caller can pass the application
and command line on the same argument.  However, the Process.Start() command
does not seem to allow this.  It forces you to specify the command line args
as a separate parameter.  Is there anyway to start a process in C# that will
work exactly the same way as CreateProcess?

I have tried to specify the application and args in the Start call as one
string, but it does not work.

Signature

---------------------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
MailID = varnk
Domain = diebold.com
---------------------------------------------

Peter Ritchie [C# MVP] - 07 Nov 2007 03:37 GMT
How about:
    System.Diagnostics.ProcessStartInfo psi = new
System.Diagnostics.ProcessStartInfo("\"c:\\WINDOWS\\system32\\notepad.exe\"
\"c:\\file.txt\"");
    psi.UseShellExecute = false;
    System.Diagnostics.Process.Start(psi);

Signature

Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#

> The CreateProcess Win32 call will allow NULL to be passed for the
> CommandLine setting.  When this is done, the caller can pass the application
[quoted text clipped - 5 lines]
> I have tried to specify the application and args in the Start call as one
> string, but it does not work.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.