ProcessStartInfo クラスとは? わかりやすく解説

ProcessStartInfo クラス

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

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

Public NotInheritable Class
 ProcessStartInfo
Dim instance As ProcessStartInfo
public sealed class ProcessStartInfo
public ref class ProcessStartInfo sealed
public final class ProcessStartInfo
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 プロパティ使用してエディタで開くテキスト ファイル指定できます

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

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

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

使用例使用例
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();
}

.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
  System.Diagnostics.ProcessStartInfo
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ProcessStartInfo クラス」の関連用語

ProcessStartInfo クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ProcessStartInfo クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS