ProcessStartInfo.Arguments 属性
获取或设置启动应用程序时要使用的一组命令行参数。
**命名空间:**System.Diagnostics
**程序集:**System(在 system.dll 中)
语法
声明
Public Property Arguments As String
用法
Dim instance As ProcessStartInfo
Dim value As String
value = instance.Arguments
instance.Arguments = value
public string Arguments { get; set; }
public:
property String^ Arguments {
String^ get ();
void set (String^ value);
}
/** @property */
public String get_Arguments ()
/** @property */
public void set_Arguments (String value)
public function get Arguments () : String
public function set Arguments (value : String)
属性值
文件类型特定的参数,系统可将它们与 FileName 属性中指定的应用程序关联。默认值为空字符串 ("")。.NET Framework 应用程序和 .NET Compact Framework 应用程序中的最大字符串长度分别为 2,003 字符和 488 字符。
示例
Imports System
Imports System.Diagnostics
Imports System.ComponentModel
Namespace MyProcessSample
_
'/ <summary>
'/ Shell for the sample.
'/ </summary>
Class MyProcess
'/ <summary>
'/ Opens the Internet Explorer application.
'/ </summary>
Public Sub OpenApplication(myFavoritesPath As String)
' 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)
End Sub 'OpenApplication
'/ <summary>
'/ Opens urls and .html documents using Internet Explorer.
'/ </summary>
Sub 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")
End Sub 'OpenWithArguments
'/ <summary>
'/ Uses the ProcessStartInfo class to start new processes, both in a minimized
'/ mode.
'/ </summary>
Sub OpenWithStartInfo()
Dim startInfo As New ProcessStartInfo("IExplore.exe")
startInfo.WindowStyle = ProcessWindowStyle.Minimized
Process.Start(startInfo)
startInfo.Arguments = "www.northwindtraders.com"
Process.Start(startInfo)
End Sub 'OpenWithStartInfo
Shared Sub Main()
' Get the path that stores favorite links.
Dim myFavoritesPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Favorites)
Dim myProcess As New MyProcess()
myProcess.OpenApplication(myFavoritesPath)
myProcess.OpenWithArguments()
myProcess.OpenWithStartInfo()
End Sub 'Main
End Class 'MyProcess
End Namespace 'MyProcessSample
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();
}
}
}
#using <System.dll>
using namespace System;
using namespace System::Diagnostics;
using namespace System::ComponentModel;
/// <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 = gcnew ProcessStartInfo( "IExplore.exe" );
startInfo->WindowStyle = ProcessWindowStyle::Minimized;
Process::Start( startInfo );
startInfo->Arguments = "www.northwindtraders.com";
Process::Start( startInfo );
}
int main()
{
// Get the path that stores favorite links.
String^ myFavoritesPath = Environment::GetFolderPath( Environment::SpecialFolder::Favorites );
OpenApplication( myFavoritesPath );
OpenWithArguments();
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
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
.NET Compact Framework
受以下版本支持:2.0
请参见
参考
ProcessStartInfo 类
ProcessStartInfo 成员
System.Diagnostics 命名空间