ProcessStartInfo.Verb Property

Gets or sets the verb to use when opening the application or document specified by the FileName property.

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

public string Verb { get; set; }
/** @property */
public String get_Verb ()

/** @property */
public void set_Verb (String value)

public function get Verb () : String

public function set Verb (value : String)

Property Value

The action to take with the file that the process opens. The default is an empty string ("").

Each file name extension has its own set of verbs, which can be obtained using the Verbs property. For example, the "print" verb will print a document specified using FileName. The default verb can be specified using an empty string ("").

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 does not need to have an extension if you manually enter a value for the Verb property.

The following example starts a new process using the specified action and file name.

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;

                    "{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, verb);
            Console.WriteLine("File not found:  {0}", fileName);
        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

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

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0

Community Additions