언어

Process.RunAndCaptureText 메서드

정의

오버로드

속성 Description
RunAndCaptureText(String, IEnumerable<String>, Nullable<TimeSpan>)

지정된 파일 이름과 선택적 인수를 사용하여 프로세스를 시작하고, 표준 출력 및 오류를 캡처하고, 종료될 때까지 기다렸다가 캡처된 텍스트 및 종료 상태를 반환합니다.

RunAndCaptureText(ProcessStartInfo, Nullable<TimeSpan>)

설명한 startInfo프로세스를 시작하고, 표준 출력 및 오류를 캡처하고, 종료될 때까지 기다린 다음, 캡처된 텍스트 및 종료 상태를 반환합니다.

RunAndCaptureText(String, IEnumerable<String>, Nullable<TimeSpan>)

Source:
Process.Scenarios.cs

지정된 파일 이름과 선택적 인수를 사용하여 프로세스를 시작하고, 표준 출력 및 오류를 캡처하고, 종료될 때까지 기다렸다가 캡처된 텍스트 및 종료 상태를 반환합니다.

[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Diagnostics.ProcessTextOutput RunAndCaptureText(string fileName, System.Collections.Generic.IEnumerable<string>? arguments = default, TimeSpan? timeout = default);
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member RunAndCaptureText : string * seq<string> * Nullable<TimeSpan> -> System.Diagnostics.ProcessTextOutput
Public Shared Function RunAndCaptureText (fileName As String, Optional arguments As IEnumerable(Of String) = Nothing, Optional timeout As Nullable(Of TimeSpan) = Nothing) As ProcessTextOutput

매개 변수

fileName
String

시작할 실행 파일의 이름입니다.

arguments
IEnumerable<String>

프로세스에 전달할 명령줄 인수입니다. 추가 인수 없이 프로세스를 시작하는 빈 시퀀스를 전달하거나 빈 시퀀스를 전달 null 합니다.

timeout
Nullable<TimeSpan>

프로세스가 종료되기를 기다리는 최대 시간입니다. 이면 null무기한 대기합니다. 프로세스가 지정된 시간 제한 내에 종료되지 않으면 종료됩니다.

반품

캡처된 텍스트 출력 및 프로세스의 종료 상태입니다.

특성

예외

timeout정수 밀리초로 자른 값이 -1 미만이거나 보다 MaxValue큽니다.

fileName은 null입니다.

fileName 가 비어 있습니다.

리디렉션된 스트림이 지정된 timeout내에서 완전히 읽지 못했습니다.

설명

리디렉션된 스트림을 읽는 동안 시간 제한이 만료되면 메서드는 프로세스를 종료하려고 시도하고 throw합니다 TimeoutException. 스트림이 완전히 읽혀졌지만 남은 시간 제한 내에 프로세스가 종료되지 않으면 프로세스가 종료되고 반환 ExitStatus 된 프로세스가 로 true설정됩니다Canceled.

적용 대상

RunAndCaptureText(ProcessStartInfo, Nullable<TimeSpan>)

Source:
Process.Scenarios.cs

설명한 startInfo프로세스를 시작하고, 표준 출력 및 오류를 캡처하고, 종료될 때까지 기다린 다음, 캡처된 텍스트 및 종료 상태를 반환합니다.

[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Diagnostics.ProcessTextOutput RunAndCaptureText(System.Diagnostics.ProcessStartInfo startInfo, TimeSpan? timeout = default);
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member RunAndCaptureText : System.Diagnostics.ProcessStartInfo * Nullable<TimeSpan> -> System.Diagnostics.ProcessTextOutput
Public Shared Function RunAndCaptureText (startInfo As ProcessStartInfo, Optional timeout As Nullable(Of TimeSpan) = Nothing) As ProcessTextOutput

매개 변수

startInfo
ProcessStartInfo

ProcessStartInfo 프로세스를 시작하는 데 사용되는 정보가 들어 있는 항목입니다.

timeout
Nullable<TimeSpan>

프로세스가 종료되기를 기다리는 최대 시간입니다. 이면 null무기한 대기합니다. 프로세스가 지정된 시간 제한 내에 종료되지 않으면 종료됩니다.

반품

캡처된 텍스트 출력 및 프로세스의 종료 상태입니다.

특성

예외

timeout정수 밀리초로 자른 값이 -1 미만이거나 보다 MaxValue큽니다.

startInfo은 null입니다.

UseShellExecute이 true로 설정됩니다.

또는

RedirectStandardOutput 또는 RedirectStandardError .로 true설정되지 않았습니다.

리디렉션된 스트림이 지정된 timeout내에서 완전히 읽지 못했습니다.

설명

리디렉션된 스트림을 읽는 동안 시간 제한이 만료되면 메서드는 프로세스를 종료하려고 시도하고 throw합니다 TimeoutException. 스트림이 완전히 읽혀졌지만 남은 시간 제한 내에 프로세스가 종료되지 않으면 프로세스가 종료되고 반환 ExitStatus 된 프로세스가 로 true설정됩니다Canceled.

적용 대상