ProcessStartInfo.CreateNoWindow ProcessStartInfo.CreateNoWindow ProcessStartInfo.CreateNoWindow ProcessStartInfo.CreateNoWindow Property

定義

プロセスを新しいウィンドウで起動するかどうかを示す値を取得または設定します。Gets or sets a value indicating whether to start the process in a new window.

public:
 property bool CreateNoWindow { bool get(); void set(bool value); };
public bool CreateNoWindow { get; set; }
member this.CreateNoWindow : bool with get, set
Public Property CreateNoWindow As Boolean

プロパティ値

プロセス用の新しいウィンドウを作成せずにプロセスを起動する場合は true、それ以外の場合は falsetrue if the process should be started without creating a new window to contain it; otherwise, false. 既定値は、false です。The default is false.

#using <System.dll>
using namespace System;
using namespace System::Diagnostics;
using namespace System::ComponentModel;

int main()
{
    Process^ myProcess = gcnew Process;

    try
    {
        myProcess->StartInfo->UseShellExecute = false;
        // You can start any process, HelloWorld is a do-nothing example.
        myProcess->StartInfo->FileName = "C:\\HelloWorld.exe";
        myProcess->StartInfo->CreateNoWindow = true;
        myProcess->Start();
        // This code assumes the process you are starting will terminate itself. 
        // Given that is is started without a window so you cannot terminate it 
        // on the desktop, it must terminate itself or you can do it programmatically
        // from this application using the Kill method.
    }
    catch ( Exception^ e ) 
    {
        Console::WriteLine( e->Message );
    }
}
using System;
using System.Diagnostics;
using System.ComponentModel;

namespace MyProcessSample
{
    class MyProcess
    {
        public static void Main()
        {
            try
            {
                using (Process myProcess = new Process())
                {
                    myProcess.StartInfo.UseShellExecute = false;
                    // You can start any process, HelloWorld is a do-nothing example.
                    myProcess.StartInfo.FileName = "C:\\HelloWorld.exe";
                    myProcess.StartInfo.CreateNoWindow = true;
                    myProcess.Start();
                    // This code assumes the process you are starting will terminate itself. 
                    // Given that is is started without a window so you cannot terminate it 
                    // on the desktop, it must terminate itself or you can do it programmatically
                    // from this application using the Kill method.
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}
Imports System
Imports System.Diagnostics
Imports System.ComponentModel

Namespace MyProcessSample
    Class MyProcess
        Public Shared Sub Main()
            Try
                Using myProcess As New Process()

                    myProcess.StartInfo.UseShellExecute = False
                    ' You can start any process, HelloWorld is a do-nothing example.
                    myProcess.StartInfo.FileName = "C:\\HelloWorld.exe"
                    myProcess.StartInfo.CreateNoWindow = True
                    myProcess.Start()
                    ' This code assumes the process you are starting will terminate itself. 
                    ' Given that is is started without a window so you cannot terminate it 
                    ' on the desktop, it must terminate itself or you can do it programmatically
                    ' from this application using the Kill method.
                End Using
            Catch e As Exception
                Console.WriteLine((e.Message))
            End Try
        End Sub 'Main
    End Class
End Namespace

注釈

UserName Password nullプロパティがtrueの場合、またはプロパティとプロパティがでCreateNoWindowない場合、プロパティ値は無視され、新しいウィンドウが作成されます。 UseShellExecuteIf the UseShellExecute property is true or the UserName and Password properties are not null, the CreateNoWindow property value is ignored and a new window is created.

.NET Core では、macOS や Linux などの Unix のようなプラットフォームでの windows の直接作成はサポートされていません。.NET Core does not support creating windows directly on Unix-like platforms, including macOS and Linux. このようなプラットフォームでは、このプロパティは無視されます。This property is ignored on such platforms.

適用対象