영어로 읽기

다음을 통해 공유


ProcessStartInfo.UseShellExecute 속성

정의

프로세스를 시작할 때 운영 체제 셸을 사용할지 여부를 나타내는 값을 가져오거나 설정합니다.

public bool UseShellExecute { get; set; }

속성 값

프로세스를 시작할 때 셸을 사용하려면 true이고, 실행 파일에서 직접 프로세스를 만들어야 하면 false입니다. 기본값은 true .NET Framework 앱 및 false .NET Core 앱에 있습니다.

예외

UWP(유니버설 Windows 플랫폼) 앱에서 값을 true로 설정하려고 시도합니다.

예제

// Run "csc.exe /r:System.dll /out:sample.exe stdstr.cs". UseShellExecute is false because we're specifying
// an executable directly and in this case depending on it being in a PATH folder. By setting
// RedirectStandardOutput to true, the output of csc.exe is directed to the Process.StandardOutput stream
// which is then displayed in this console window directly.
using (Process compiler = new Process())
{
    compiler.StartInfo.FileName = "csc.exe";
    compiler.StartInfo.Arguments = "/r:System.dll /out:sample.exe stdstr.cs";
    compiler.StartInfo.UseShellExecute = false;
    compiler.StartInfo.RedirectStandardOutput = true;
    compiler.Start();

    Console.WriteLine(compiler.StandardOutput.ReadToEnd());

    compiler.WaitForExit();
}

설명

이 API에 대한 자세한 내용은 ProcessStartInfo.UseShellExecute에 대한 추가 API 설명을 참조하세요.

적용 대상

제품 버전
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

추가 정보