ProcessStartInfo.Verb プロパティ
FileName プロパティで指定したアプリケーションまたはドキュメントを開くときに使用する動詞を取得または設定します。
名前空間: System.Diagnostics
アセンブリ: System (system.dll 内)
構文

ファイル名の拡張子ごとに、独自の動詞のセットがあります。これは、Verbs プロパティを使用して取得できます。たとえば、動詞 "print" は、FileName を使用して指定したドキュメントを印刷します。既定の動詞は、空の文字列 ("") を使用して指定できます。
Verbs プロパティを使用する場合は、FileName プロパティの値を設定するときに、ファイル名の拡張子を含める必要があります。Verb プロパティの値を手動で入力する場合、ファイル名に拡張子を付ける必要はありません。

指定したアクションおよびファイル名を使用して新しいプロセスを開始する例を次に示します。
Public Shared Sub StartWithVerb(fileName As String, verb As String, _ args As String) If Not (fileName Is Nothing) AndAlso fileName.Length > 0 _ AndAlso Not (verb Is Nothing) AndAlso verb.Length > 0 If File.Exists(fileName) Dim startInfo As ProcessStartInfo startInfo = New ProcessStartInfo(fileName) startInfo.Verb = verb startInfo.Arguments = args Dim newProcess As New Process() newProcess.StartInfo = startInfo Try newProcess.Start() Console.WriteLine( _ "{0} for file {1} started successfully with verb ""{2}""!", _ newProcess.ProcessName, fileName, startInfo.Verb) Catch e As System.ComponentModel.Win32Exception Console.WriteLine(" Win32Exception caught!") Console.WriteLine(" Win32 error = {0}", e.Message) Catch e As System.InvalidOperationException ' Catch this exception if the process exits quickly, ' and the properties are not accessible. Console.WriteLine("File {0} started with verb {1}", _ startInfo.FileName, startInfo.Verb.ToString()) End Try End If End If End Sub
public static void StartWithVerb(string fileName, string verb, string args) { if (((fileName != null) && (fileName.Length > 0)) && ((verb != null) && (verb.Length > 0))) { if (File.Exists(fileName)) { ProcessStartInfo startInfo; startInfo = new ProcessStartInfo(fileName); startInfo.Verb = verb; startInfo.Arguments = args; Process newProcess = new Process(); newProcess.StartInfo = startInfo; try { newProcess.Start(); Console.WriteLine( "{0} for file {1} started successfully with verb \"{2}\"!", newProcess.ProcessName, fileName, startInfo.Verb); } catch (System.ComponentModel.Win32Exception e) { Console.WriteLine(" Win32Exception caught!"); Console.WriteLine(" Win32 error = {0}", e.Message); } catch (System.InvalidOperationException) { // Catch this exception if the process exits quickly, // and the properties are not accessible. Console.WriteLine("File {0} started with verb {1}", fileName, verb); } } else { Console.WriteLine("File not found: {0}", fileName); } } else { Console.WriteLine("Invalid input for file name or verb."); } }
void StartWithVerb( String^ fileName, String^ verb, String^ args ) { if ( ((fileName != nullptr) && (fileName->Length > 0)) && ((verb != nullptr) && (verb->Length > 0)) ) { if ( File::Exists( fileName ) ) { ProcessStartInfo^ startInfo; startInfo = gcnew ProcessStartInfo( fileName ); startInfo->Verb = verb; startInfo->Arguments = args; Process^ newProcess = gcnew Process; newProcess->StartInfo = startInfo; try { newProcess->Start(); Console::WriteLine( "{0} for file {1} started successfully with verb \"{2}\"!", newProcess->ProcessName, fileName, startInfo->Verb ); } catch ( System::ComponentModel::Win32Exception^ e ) { Console::WriteLine( " Win32Exception caught!" ); Console::WriteLine( " Win32 error = {0}", e->Message ); } catch ( System::InvalidOperationException^ ) { // Catch this exception if the process exits quickly, // and the properties are not accessible. Console::WriteLine( "File {0} started with verb {1}", fileName, verb ); } } else { Console::WriteLine( "File not found: {0}", fileName ); } } else { Console::WriteLine( "Invalid input for file name or verb." ); } }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からProcessStartInfo.Verb プロパティを検索する場合は、下記のリンクをクリックしてください。

- ProcessStartInfo.Verb プロパティのページへのリンク