ProcessStartInfo.CreateNoWindow Eigenschaft
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Ruft einen Wert ab, der angibt, ob der Prozess in einem neuen Fenster gestartet werden soll, oder legt diesen fest.
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
Eigenschaftswert
true
, wenn der Prozess ohne Erstellung eines neuen, für ihn bestimmten Fensters gestartet werden soll, andernfalls false
. Der Standardwert ist false
.
Beispiele
#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 it 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 it 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.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 it 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
End Class
End Namespace
Hinweise
Wenn die UseShellExecute Eigenschaft oder die UserName Eigenschaften und Password nicht null
sind, wird der CreateNoWindow Eigenschaftswert ignoriert, und es wird ein true
neues Fenster erstellt.
.NET Core unterstützt nicht das direkte Erstellen von Fenstern auf Unix-ähnlichen Plattformen, einschließlich macOS und Linux. Diese Eigenschaft wird auf solchen Plattformen ignoriert.
Gilt für:
Feedback
Feedback senden und anzeigen für