This documentation is archived and is not being maintained.

ProcessStartInfo.Verbs Property

Gets the set of verbs associated with the type of file specified by the FileName property.

Namespace:  System.Diagnostics
Assembly:  System (in System.dll)

public string[] Verbs { get; }

Property Value

Type: System.String[]
The actions that the system can apply to the file indicated by the FileName property.

The Verbs property enables you to determine the verbs that can be used with the file specified by the FileName property. You can set the Verb property to the value of any verb in the set. Examples of verbs are "Edit", "Open", "OpenAsReadOnly", "Print", and "Printto".

When you use the Verbs property, you must include the file name extension when you set the value of the FileName property. The file name extension determines the set of possible verbs.

The following code example displays the defined verbs for the chosen file name. If the user selects one of the defined verbs, the example starts a new process using the selected verb and the input file name.

using System;
using System.IO;
using System.Diagnostics;
using System.Text;
using System.Windows.Forms;

class ProcessInformation
    static void Main(string[] args)
        string fileName = "";
        string arguments = "";
        string verbToUse = "";
        int i = 0;
        ProcessStartInfo startInfo = new ProcessStartInfo();
        OpenFileDialog openFileDialog1 = new OpenFileDialog();

        openFileDialog1.InitialDirectory = "c:\\";
        openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
        openFileDialog1.FilterIndex = 2;
        openFileDialog1.RestoreDirectory = true;

        if (openFileDialog1.ShowDialog() == DialogResult.OK)
            if ((fileName = openFileDialog1.FileName) != null)
                startInfo = new ProcessStartInfo(fileName);

                if (File.Exists(fileName))
                    i = 0;
                    foreach (String verb in startInfo.Verbs)
                        // Display the possible verbs.
                        Console.WriteLine("  {0}. {1}", i.ToString(), verb);

            Console.WriteLine("Select the index of the verb.");
            string index = Console.ReadLine();
            if (Convert.ToInt32(index) < i)
                verbToUse = startInfo.Verbs[Convert.ToInt32(index)];
            startInfo.Verb = verbToUse;
            if (verbToUse.ToLower().IndexOf("printto") >= 0)
                // printto implies a specific printer.  Ask for the network address. 
                // The address must be in the form \\server\printer. 
                // The printer address is passed as the Arguments property.
                Console.WriteLine("Enter the network address of the target printer:");
                arguments = Console.ReadLine();
                startInfo.Arguments = arguments;

            Process newProcess = new Process();
            newProcess.StartInfo = startInfo;


                    "{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}",
            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, verbToUse);

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0