ProcessStartInfo.Verb プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ProcessStartInfo.Verb プロパティの意味・解説 

ProcessStartInfo.Verb プロパティ

FileName プロパティ指定したアプリケーションまたはドキュメントを開くときに使用する動詞取得または設定します

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

解説解説
使用例使用例

指定したアクションおよびファイル名使用して新しプロセス開始する例を次に示します

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." );
   }
}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ProcessStartInfo クラス
ProcessStartInfo メンバ
System.Diagnostics 名前空間
Verbs


このページでは「.NET Framework クラス ライブラリ リファレンス」からProcessStartInfo.Verb プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からProcessStartInfo.Verb プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からProcessStartInfo.Verb プロパティ を検索

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

辞書ショートカット

すべての辞書の索引

「ProcessStartInfo.Verb プロパティ」の関連用語

ProcessStartInfo.Verb プロパティのお隣キーワード
検索ランキング

   

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



ProcessStartInfo.Verb プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS