Export (0) Print
Expand All

ProcessStartInfo.Arguments Property

Gets or sets the set of command line arguments to use when starting the application.

Namespace: System.Diagnostics
Assembly: System (in system.dll)

public string Arguments { get; set; }
/** @property */
public String get_Arguments ()

/** @property */
public void set_Arguments (String value)

public function get Arguments () : String

public function set Arguments (value : String)

Property Value

File type-specific arguments that the system can associate with the application specified in the FileName property. The default is an empty string (""). The maximum string length is 2,003 characters in .NET Framework applications and 488 characters in .NET Compact Framework applications.

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

namespace MyProcessSample
{
	/// <summary>
	/// Shell for the sample.
	/// </summary>
	class MyProcess
	{
	   
		/// <summary>
		/// Opens the Internet Explorer application.
		/// </summary>
		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>
		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>
		void OpenWithStartInfo()
		{
			
			ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
			startInfo.WindowStyle = ProcessWindowStyle.Minimized;
			
			Process.Start(startInfo);
			
			startInfo.Arguments = "www.northwindtraders.com";
			
			Process.Start(startInfo);
			
		}

		static void Main()
		{
            		// Get the path that stores favorite links.
            		string myFavoritesPath = 
                	Environment.GetFolderPath(Environment.SpecialFolder.Favorites);
                
            		MyProcess myProcess = new MyProcess();
         
			myProcess.OpenApplication(myFavoritesPath);
			myProcess.OpenWithArguments();
			myProcess.OpenWithStartInfo();

       		}	
	}
}

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft