ProcessStartInfo 클래스

정의

프로세스를 시작할 때 사용되는 값 집합을 지정합니다.

public ref class ProcessStartInfo sealed
public sealed class ProcessStartInfo
[System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
public sealed class ProcessStartInfo
type ProcessStartInfo = class
[<System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))>]
type ProcessStartInfo = class
Public NotInheritable Class ProcessStartInfo
상속
ProcessStartInfo
특성

예제

다음 코드 예제를 사용 하는 방법을 보여 줍니다.는 ProcessStartInfo 인터넷 Explorer 시작 하는 클래스입니다. 대상 URL은 인수로 ProcessStartInfo 제공됩니다.

#using <System.dll>

using namespace System;
using namespace System::Diagnostics;
using namespace System::ComponentModel;

// Opens the Internet Explorer application.
void OpenApplication(String^ myFavoritesPath)
{
    // Start Internet Explorer. Defaults to the home page.
    Process::Start("IExplore.exe");

    // Display the contents of the favorites folder in the browser.
    Process::Start(myFavoritesPath);
}

// Opens urls and .html documents using Internet Explorer.
void OpenWithArguments()
{
    // URLs are not considered documents. They can only be opened
    // by passing them as arguments.
    Process::Start("IExplore.exe", "www.northwindtraders.com");

    // Start a Web page using a browser associated with .html and .asp files.
    Process::Start("IExplore.exe", "C:\\myPath\\myFile.htm");
    Process::Start("IExplore.exe", "C:\\myPath\\myFile.asp");
}

// Uses the ProcessStartInfo class to start new processes,
// both in a minimized mode.
void OpenWithStartInfo()
{
    ProcessStartInfo^ startInfo = gcnew ProcessStartInfo("IExplore.exe");
    startInfo->WindowStyle = ProcessWindowStyle::Minimized;
    Process::Start(startInfo);
    startInfo->Arguments = "www.northwindtraders.com";
    Process::Start(startInfo);
}

int main()
{
    // Get the path that stores favorite links.
    String^ myFavoritesPath = Environment::GetFolderPath(Environment::SpecialFolder::Favorites);
    OpenApplication(myFavoritesPath);
    OpenWithArguments();
    OpenWithStartInfo();
}
using System;
using System.Diagnostics;
using System.ComponentModel;

namespace MyProcessSample
{
    class MyProcess
    {
        // Opens the Internet Explorer application.
        void OpenApplication(string myFavoritesPath)
        {
            // Start Internet Explorer. Defaults to the home page.
            Process.Start("IExplore.exe");

            // Display the contents of the favorites folder in the browser.
            Process.Start(myFavoritesPath);
        }

        // Opens urls and .html documents using Internet Explorer.
        void OpenWithArguments()
        {
            // url's are not considered documents. They can only be opened
            // by passing them as arguments.
            Process.Start("IExplore.exe", "www.northwindtraders.com");

            // Start a Web page using a browser associated with .html and .asp files.
            Process.Start("IExplore.exe", "C:\\myPath\\myFile.htm");
            Process.Start("IExplore.exe", "C:\\myPath\\myFile.asp");
        }

        // Uses the ProcessStartInfo class to start new processes,
        // both in a minimized mode.
        void OpenWithStartInfo()
        {
            ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
            startInfo.WindowStyle = ProcessWindowStyle.Minimized;

            Process.Start(startInfo);

            startInfo.Arguments = "www.northwindtraders.com";

            Process.Start(startInfo);
        }

        static void Main()
        {
            // Get the path that stores favorite links.
            string myFavoritesPath =
                Environment.GetFolderPath(Environment.SpecialFolder.Favorites);

            MyProcess myProcess = new MyProcess();

            myProcess.OpenApplication(myFavoritesPath);
            myProcess.OpenWithArguments();
            myProcess.OpenWithStartInfo();
        }
    }
}
Imports System.Diagnostics
Imports System.ComponentModel

Namespace MyProcessSample
    Class MyProcess
        ' Opens the Internet Explorer application.
        Public Sub OpenApplication(myFavoritesPath As String)
            ' Start Internet Explorer. Defaults to the home page.
            Process.Start("IExplore.exe")

            ' Display the contents of the favorites folder in the browser.
            Process.Start(myFavoritesPath)
        End Sub

        ' Opens URLs and .html documents using Internet Explorer.
        Sub OpenWithArguments()
            ' URLs are not considered documents. They can only be opened
            ' by passing them as arguments.
            Process.Start("IExplore.exe", "www.northwindtraders.com")

            ' Start a Web page using a browser associated with .html and .asp files.
            Process.Start("IExplore.exe", "C:\myPath\myFile.htm")
            Process.Start("IExplore.exe", "C:\myPath\myFile.asp")
        End Sub

        ' Uses the ProcessStartInfo class to start new processes,
        ' both in a minimized mode.
        Sub OpenWithStartInfo()
            Dim startInfo As New ProcessStartInfo("IExplore.exe")
            startInfo.WindowStyle = ProcessWindowStyle.Minimized

            Process.Start(startInfo)

            startInfo.Arguments = "www.northwindtraders.com"

            Process.Start(startInfo)
        End Sub

        Shared Sub Main()
            ' Get the path that stores favorite links.
            Dim myFavoritesPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Favorites)

            Dim myProcess As New MyProcess()

            myProcess.OpenApplication(myFavoritesPath)
            myProcess.OpenWithArguments()
            myProcess.OpenWithStartInfo()
        End Sub
    End Class
End Namespace 'MyProcessSample

설명

ProcessStartInfo 는 구성 요소와 Process 함께 사용됩니다. 클래스를 사용하여 Process 프로세스를 시작하면 실행 중인 프로세스에 연결할 때 사용할 수 있는 정보 외에도 프로세스 정보에 액세스할 수 있습니다.

클래스를 ProcessStartInfo 사용하여 시작하는 프로세스를 더 잘 제어할 수 있습니다. 수동으로 또는 생성자를 사용하여 적어도 속성을 설정 FileName 해야 합니다. 파일 이름은 애플리케이션 또는 문서입니다. 여기서 문서는 열려 있거나 기본 동작이 연결된 모든 파일 형식으로 정의됩니다. 보면 등록 된 파일 형식과 연결 된 애플리케이션 사용자의 컴퓨터에 대 한 사용 하 여 합니다 폴더 옵션 운영 체제를 통해 사용할 수 있는 대화 상자. 고급 단추는 특정 등록된 파일 형식과 연결된 열린 작업이 있는지 여부를 보여 주는 대화 상자로 연결됩니다.

또한 해당 파일로 수행할 작업을 정의하는 다른 속성을 설정할 수 있습니다. 속성의 FileName 속성 Verb 형식과 관련된 값을 지정할 수 있습니다. 예를 들어 문서 형식에 대해 "인쇄"를 지정할 수 있습니다. 또한 파일의 열린 프로시저에 전달할 명령줄 인수로 속성 값을 지정할 Arguments 수 있습니다. 예를 들어, 텍스트 편집기 애플리케이션을 지정 하는 경우는 FileName 속성을 사용할 수는 Arguments 속성을 텍스트 파일을 편집기에서 열 수를 지정 합니다.

표준 입력은 일반적으로 키보드이며 표준 출력 및 표준 오류는 일반적으로 모니터 화면입니다. 사용할 수 있습니다는 RedirectStandardInput, RedirectStandardOutput, 및 RedirectStandardError 에서 입력 또는 출력 파일 또는 다른 디바이스로 반환 하는 프로세스를 시킬 속성입니다. 구성 요소에서 StandardInput, StandardOutput또는 StandardError 속성을 사용하는 경우 먼저 속성 Process 에서 ProcessStartInfo 해당 값을 설정해야 합니다. 그렇지 않으면 스트림을 읽거나 쓸 때 시스템에서 예외를 throw합니다.

UseShellExecute 속성을 설정하여 운영 체제 셸을 사용하여 프로세스를 시작할지 여부를 지정합니다. 가 로 설정된 경우 UseShellExecute , 또는 RedirectStandardError 속성이 각각 로 설정되지 않는 한 RedirectStandardOutputRedirectStandardInput새 프로세스는 호출 프로세스의 표준 입력, 표준 출력 및 표준 오류 스트림을 true상속합니다.false

프로세스가 시작되는 시간까지 모든 ProcessStartInfo 속성의 값을 변경할 수 있습니다. 프로세스를 시작한 후에는 이러한 값을 변경해도 아무런 효과가 없습니다.

중요

신뢰할 수 없는 데이터로 이 개체의 인스턴스를 사용하는 것은 보안상 위험합니다. 신뢰할 수 있는 데이터로만 이 개체를 사용하세요. 자세한 내용은 모든 입력 유효성 검사를 참조하세요.

참고

이 클래스는 모든 멤버에 적용 되는 클래스 수준에서 링크 요청을 포함 합니다. SecurityException 직접 실행 호출자에 full trust 권한이 없는 경우 throw 됩니다. 보안 요청에 대 한 자세한 내용은 참조 하세요 링크 요구가합니다.

생성자

ProcessStartInfo()

프로세스를 시작할 때 사용할 파일 이름을 지정하지 않고 ProcessStartInfo 클래스의 새 인스턴스를 초기화합니다.

ProcessStartInfo(String)

ProcessStartInfo 클래스의 새 인스턴스를 초기화하고 프로세스를 시작할 때 사용할 애플리케이션이나 문서와 같은 파일 이름을 지정합니다.

ProcessStartInfo(String, IEnumerable<String>)

프로세스를 시작할 때 사용되는 값 집합을 지정합니다.

ProcessStartInfo(String, String)

ProcessStartInfo 클래스의 새 인스턴스를 초기화하고, 프로세스를 시작할 애플리케이션 파일 이름과 애플리케이션에 전달할 명령줄 인수 집합을 지정합니다.

속성

ArgumentList

애플리케이션을 시작할 때 사용할 명령줄 인수 컬렉션을 가져오거나 설정합니다. 목록에 추가된 문자열은 이전에 이스케이프한 문자열일 필요가 없습니다.

Arguments

애플리케이션을 시작할 때 사용할 명령줄 인수 집합을 가져오거나 설정합니다.

CreateNoWindow

프로세스를 새 창에서 시작할지 여부를 나타내는 값을 가져오거나 설정합니다.

Domain

프로세스를 시작할 때 사용할 도메인을 식별하는 값을 가져오거나 설정합니다. 이 값이 null이면 UserName 속성은 UPN 형식으로 지정되어야 합니다.

Environment

이 프로세스와 자식 프로세스에 적용되는 환경 변수를 가져옵니다.

EnvironmentVariables

파일 검색 경로, 임시파일의 디렉터리, 애플리케이션별 옵션 및 기타 유사한 정보를 가져옵니다.

ErrorDialog

프로세스를 시작할 수 없는 경우 사용자에게 오류 대화 상자를 표시할지 여부를 나타내는 값을 가져오거나 설정합니다.

ErrorDialogParentHandle

프로세스를 시작할 수 없음을 알리는 오류 대화 상자가 표시될 때 사용할 창 핸들을 가져오거나 설정합니다.

FileName

시작할 애플리케이션 또는 문서를 가져오거나 설정합니다.

LoadUserProfile

Windows 사용자 프로필을 레지스트리에서 로드할지 여부를 나타내는 값을 가져오거나 설정합니다.

Password

프로세스를 시작할 때 사용할 사용자 암호가 포함된 보안 문자열을 가져오거나 설정합니다.

PasswordInClearText

프로세스를 시작할 때 사용할 일반 텍스트 형식의 사용자 암호를 가져오거나 설정합니다.

RedirectStandardError

애플리케이션의 오류 출력을 StandardError 스트림에 쓸지 여부를 나타내는 값을 가져오거나 설정합니다.

RedirectStandardInput

애플리케이션의 입력을 StandardInput 스트림에서 읽을지 여부를 나타내는 값을 가져오거나 설정합니다.

RedirectStandardOutput

애플리케이션의 텍스트 출력을 StandardOutput 스트림에 쓸지 여부를 나타내는 값을 가져오거나 설정합니다.

StandardErrorEncoding

오류 출력에 대한 기본 설정 인코딩을 가져오거나 설정합니다.

StandardInputEncoding

표준 입력에 대한 기본 설정 인코딩을 가져오거나 설정합니다.

StandardOutputEncoding

표준 출력에 대한 기본 설정 인코딩을 가져오거나 설정합니다.

UseCredentialsForNetworkingOnly

프로세스를 시작할 때 사용되는 값 집합을 지정합니다.

UserName

프로세스를 시작할 때 사용할 사용자 이름을 가져오거나 설정합니다. user@DNS_domain_name UPN 형식을 사용 하는 경우 Domain 속성은 null이어야 합니다.

UseShellExecute

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

Verb

FileName 속성이 지정한 애플리케이션이나 문서를 열 때 사용할 동사를 가져오거나 설정합니다.

Verbs

FileName 속성이 지정한 파일 형식과 연결된 동사 집합을 가져옵니다.

WindowStyle

프로세스가 시작될 때 사용할 창 상태를 가져오거나 설정합니다.

WorkingDirectory

UseShellExecute 속성이 false인 경우 시작할 프로세스의 작업 디렉터리를 가져오거나 설정합니다. UseShellExecutetrue인 경우 시작할 프로세스가 포함된 디렉터리를 가져오거나 설정합니다.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보