Process.RunAsync Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Overloads
| Naam | Description |
|---|---|
| RunAsync(ProcessStartInfo, CancellationToken) |
Asynchroon start het proces dat wordt beschreven door |
| RunAsync(String, IEnumerable<String>, Boolean, CancellationToken) |
Asynchroon start een proces met de opgegeven bestandsnaam en optionele argumenten, wacht tot deze is afgesloten en retourneert de afsluitstatus. |
RunAsync(ProcessStartInfo, CancellationToken)
- Bron:
- Process.Scenarios.cs
Asynchroon start het proces dat wordt beschreven door startInfo, wacht tot het proces is afgesloten en retourneert de afsluitstatus.
[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Threading.Tasks.Task<System.Diagnostics.ProcessExitStatus> RunAsync(System.Diagnostics.ProcessStartInfo startInfo, System.Threading.CancellationToken cancellationToken = default);
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member RunAsync : System.Diagnostics.ProcessStartInfo * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Diagnostics.ProcessExitStatus>
Public Shared Function RunAsync (startInfo As ProcessStartInfo, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ProcessExitStatus)
Parameters
- startInfo
- ProcessStartInfo
De ProcessStartInfo informatie die wordt gebruikt om het proces te starten.
- cancellationToken
- CancellationToken
Een token om de asynchrone bewerking te annuleren. Als het token wordt geannuleerd, wordt het proces beëindigd.
Retouren
Een taak die de asynchrone bewerking vertegenwoordigt. De waarde van de taak bevat de afsluitstatus van het proces. Als het proces wordt gedood vanwege annulering, Canceled is true.
- Kenmerken
Uitzonderingen
startInfo is null.
UseShellExecute is ingesteld op true.
– of –
RedirectStandardInput, RedirectStandardOutputof RedirectStandardError is ingesteld op true. Gebruik in plaats daarvan de bijbehorende standaardgreepeigenschappen om ingangen te leveren.
Van toepassing op
RunAsync(String, IEnumerable<String>, Boolean, CancellationToken)
- Bron:
- Process.Scenarios.cs
Asynchroon start een proces met de opgegeven bestandsnaam en optionele argumenten, wacht tot deze is afgesloten en retourneert de afsluitstatus.
[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Threading.Tasks.Task<System.Diagnostics.ProcessExitStatus> RunAsync(string fileName, System.Collections.Generic.IEnumerable<string>? arguments = default, bool silent = false, System.Threading.CancellationToken cancellationToken = default);
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member RunAsync : string * seq<string> * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Diagnostics.ProcessExitStatus>
Public Shared Function RunAsync (fileName As String, Optional arguments As IEnumerable(Of String) = Nothing, Optional silent As Boolean = false, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ProcessExitStatus)
Parameters
- fileName
- String
De naam van het uitvoerbare bestand dat moet worden gestart.
- arguments
- IEnumerable<String>
De opdrachtregelargumenten die moeten worden doorgegeven aan het proces. Geef null of een lege reeks door om het proces te starten zonder extra argumenten.
- silent
- Boolean
Wanneer true, wordt standaardinvoer, uitvoer en fout omgeleid naar het null-apparaat, zodat het proces geen zichtbare console-uitvoer produceert. Wanneer false, neemt het proces standaardgrepen over van het bovenliggende item.
- cancellationToken
- CancellationToken
Een token om de asynchrone bewerking te annuleren. Als het token wordt geannuleerd, wordt het proces beëindigd.
Retouren
Een taak die de asynchrone bewerking vertegenwoordigt. De waarde van de taak bevat de afsluitstatus van het proces. Als het proces wordt gedood vanwege annulering, Canceled is true.
- Kenmerken
Uitzonderingen
fileName is null.
fileName is leeg.