クリックして評価とフィードバックをお寄せください
MSDN
MSDN ライブラリ
.NET 開発
以前のバージョン
.NET Framework SDK 2.0
System.Diagnostics
ProcessStartInfo クラス
すべて縮小/すべて展開 すべて縮小
このページは次のバージョンについて記述しています。
Microsoft Visual Studio 2005/.NET Framework 2.0

その他のバージョンについては、以下の情報を参照してください。
.NET Framework クラス ライブラリ
ProcessStartInfo クラス

プロセスを起動するときに使用する値のセットを指定します。

名前空間: System.Diagnostics
アセンブリ: System (system.dll 内)

Visual Basic (宣言)
Public NotInheritable Class ProcessStartInfo
Visual Basic (使用法)
Dim instance As ProcessStartInfo
C#
public sealed class ProcessStartInfo
C++
public ref class ProcessStartInfo sealed
J#
public final class ProcessStartInfo
JScript
public final class ProcessStartInfo
メモメモ

このクラスに適用される HostProtectionAttribute 属性の Resources プロパティの値は、SharedState または SelfAffectingProcessMgmt です。HostProtectionAttribute は、デスクトップ アプリケーション (一般的には、アイコンをダブルクリック、コマンドを入力、またはブラウザに URL を入力して起動するアプリケーション) には影響しません。詳細については、HostProtectionAttribute クラスのトピックまたは「SQL Server プログラミングとホスト保護属性」を参照してください。

ProcessStartInfo は、Process コンポーネントと組み合わせて使用します。Process クラスを使用してプロセスを起動すると、実行中のプロセスに接続するときに利用できる情報だけでなく、プロセス情報にもアクセスできます。

ProcessStartInfo クラスを使用して、起動するプロセスをさらに制御できます。少なくとも、手動またはコンストラクタを使用して、FileName プロパティを設定する必要があります。ファイル名は、任意のアプリケーションまたはドキュメントにします。ここでいうドキュメントとは、"open" という既定のアクションが関連付けられている任意のファイル タイプです。登録されているファイル タイプと、コンピュータ上でこれらに関連付けられているアプリケーションは、オペレーティング システムを通じて利用できる [フォルダ オプション] ダイアログ ボックスで参照できます。[詳細設定] ボタンを使用すると、登録されている特定のファイル タイプに "open" アクションが関連付けられているかどうかを示すダイアログ ボックスが表示されます。

さらにその他のプロパティを設定して、そのファイルに対して実行するアクションを定義できます。FileName プロパティの種類に固有の値を Verb プロパティに指定できます。たとえば、ドキュメントの種類に対して "印刷" を指定できます。さらに、ファイルのオープン プロシージャに渡すコマンド ライン引数になるように、Arguments プロパティ値を指定できます。たとえば、FileName プロパティにテキスト エディタ アプリケーションを指定すると、Arguments プロパティを使用してエディタで開くテキスト ファイルを指定できます。

標準入力は通常、キーボードで、標準出力と標準エラー出力は通常、モニタ画面です。ただし、RedirectStandardInputRedirectStandardOutputRedirectStandardError の各プロパティを使用すると、プロセスが入力を取得したり出力を返す先をファイルまたはその他のデバイスにできます。Process コンポーネントの StandardInputStandardOutput、または StandardError の各プロパティを使用する場合は、まず対応する値を ProcessStartInfo プロパティに設定する必要があります。設定しないと、ストリームの読み取りまたは書き込みを実行したときに、例外がスローされます。

UseShellExecute を設定し、オペレーティング システムのシェルを使用してプロセスを起動するかどうかを指定します。

ProcessStartInfo プロパティの値を変更できるのは、プロセスを起動するまでです。プロセスを開始した後で、これらの値を変更しても影響はありません。

メモメモ

このクラスには、すべてのメンバに適用されるクラス レベルのリンク確認要求が格納されます。直前の呼び出し元に完全信頼のアクセス許可がない場合は、SecurityException がスローされます。セキュリティ要求の詳細については、「リンク確認要求」を参照してください。

Visual Basic
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
C#
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();

               }    
    }
}
C++
#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();
}
System.Object
  System.Diagnostics.ProcessStartInfo
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

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
コミュニティ コンテンツ   コミュニティ コンテンツとは
新しいコンテンツの追加 RSS  注釈
Processing
© 2009 Microsoft Corporation. All rights reserved. 使用条件 | 商標 | プライバシー
Page view tracker