ProcessStartInfo 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
프로세스를 시작할 때 사용되는 값 집합을 지정합니다.
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 Internet Explorer를 시작하는 방법을 보여 줍니다. 대상 URL은 인수로 ProcessStartInfo 제공됩니다.
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 수 있습니다. 예를 들어 속성에서 텍스트 편집기 응용 프로그램을 지정하는 경우 이 속성을 사용하여 Arguments 편집기에서 FileName 열 텍스트 파일을 지정할 수 있습니다.
표준 입력은 일반적으로 키보드이며 표준 출력 및 표준 오류는 일반적으로 모니터 화면입니다. 그러나 , RedirectStandardOutput및 RedirectStandardError 속성을 사용하여 RedirectStandardInput프로세스가 파일 또는 다른 디바이스에서 입력을 받거나 출력을 반환하도록 할 수 있습니다. 구성 요소에서 StandardInput또는 StandardOutputStandardError 속성을 Process 사용하는 경우 먼저 속성에 ProcessStartInfo 해당 값을 설정해야 합니다. 그렇지 않으면 스트림을 읽거나 쓸 때 시스템에서 예외를 throw합니다.
UseShellExecute 운영 체제 셸을 사용하여 프로세스를 시작할지 여부를 지정하도록 속성을 설정합니다. 설정되면 UseShellExecute 새 프로세스는 호출 프로세스의 표준 입력, 표준 출력 및 표준 오류 스트림을 상속합니다( 각각 또는 RedirectStandardErrorRedirectStandardOutput속성이 설정true되지 않은 경우RedirectStandardInputfalse).
프로세스가 시작되는 시간까지 모든 ProcessStartInfo 속성의 값을 변경할 수 있습니다. 프로세스를 시작한 후에는 이러한 값을 변경해도 아무런 영향을 주지 않습니다.
중요합니다
신뢰할 수 없는 데이터와 함께 이 형식의 인스턴스를 사용하는 것은 보안 위험입니다. 신뢰할 수 있는 데이터에서만 이 개체를 사용합니다. 자세한 내용은 모든 입력 유효성 검사참조하세요.
메모
이 클래스에는 모든 멤버에 적용되는 클래스 수준의 링크 요청이 포함되어 있습니다. 직접 호출자에게 완전 신뢰 권한이 없는 경우 A SecurityException 가 throw됩니다. 보안 요구 사항에 대한 자세한 내용은 링크 요구를 참조하세요.
생성자
| Name | Description |
|---|---|
| ProcessStartInfo() |
프로세스를 시작할 파일 이름을 지정하지 않고 클래스의 ProcessStartInfo 새 인스턴스를 초기화합니다. |
| ProcessStartInfo(String, IEnumerable<String>) |
클래스의 새 인스턴스를 ProcessStartInfo 초기화하고 시작할 애플리케이션의 이름과 애플리케이션에 전달할 명령줄 인수 집합을 지정합니다. |
| ProcessStartInfo(String, String) |
클래스의 ProcessStartInfo 새 인스턴스를 초기화하고, 프로세스를 시작할 애플리케이션 파일 이름을 지정하고, 애플리케이션에 전달할 명령줄 인수 집합을 지정합니다. |
| ProcessStartInfo(String) |
클래스의 새 인스턴스를 ProcessStartInfo 초기화하고 프로세스를 시작할 애플리케이션 또는 문서와 같은 파일 이름을 지정합니다. |
속성
| Name | Description |
|---|---|
| ArgumentList |
애플리케이션을 시작할 때 사용할 명령줄 인수의 컬렉션을 가져옵니다. 목록에 추가된 문자열은 이전에 이스케이프할 필요가 없습니다. |
| Arguments |
애플리케이션을 시작할 때 사용할 명령줄 인수 집합을 가져오거나 설정합니다. |
| CreateNewProcessGroup |
새 프로세스 그룹에서 프로세스를 시작할지 여부를 나타내는 값을 가져오거나 설정합니다. |
| CreateNoWindow |
새 창에서 프로세스를 시작할지 여부를 나타내는 값을 가져오거나 설정합니다. |
| Domain |
프로세스를 시작할 때 사용할 도메인을 식별하는 값을 가져오거나 설정합니다. 이 값이 |
| Environment |
이 프로세스 및 해당 자식 프로세스에 적용되는 환경 변수를 가져옵니다. |
| EnvironmentVariables |
파일, 임시 파일의 디렉터리, 애플리케이션별 옵션 및 기타 유사한 정보에 대한 검색 경로를 가져옵니다. |
| ErrorDialog |
프로세스를 시작할 수 없는 경우 사용자에게 오류 대화 상자가 표시되는지 여부를 나타내는 값을 가져오거나 설정합니다. |
| ErrorDialogParentHandle |
시작할 수 없는 프로세스에 대해 오류 대화 상자가 표시될 때 사용할 창 핸들을 가져오거나 설정합니다. |
| FileName |
시작할 애플리케이션 또는 문서를 가져오거나 설정합니다. |
| LoadUserProfile |
레지스트리에서 Windows 사용자 프로필을 로드할지 여부를 나타내는 값을 가져오거나 설정합니다. |
| Password |
프로세스를 시작할 때 사용할 사용자 암호를 포함하는 보안 문자열을 가져오거나 설정합니다. |
| PasswordInClearText |
프로세스를 시작할 때 사용할 사용자 암호를 지우기 텍스트로 가져오거나 설정합니다. |
| RedirectStandardError |
애플리케이션의 오류 출력이 스트림에 기록 StandardError 되는지 여부를 나타내는 값을 가져오거나 설정합니다. |
| RedirectStandardInput |
애플리케이션의 입력이 스트림에서 StandardInput 읽혀지는지 여부를 나타내는 값을 가져오거나 설정합니다. |
| RedirectStandardOutput |
애플리케이션의 텍스트 출력이 스트림에 기록 StandardOutput 되는지 여부를 나타내는 값을 가져오거나 설정합니다. |
| StandardErrorEncoding |
오류 출력에 대한 기본 인코딩을 가져오거나 설정합니다. |
| StandardInputEncoding |
표준 입력에 대한 기본 인코딩을 가져오거나 설정합니다. |
| StandardOutputEncoding |
표준 출력에 대한 기본 인코딩을 가져오거나 설정합니다. |
| UseCredentialsForNetworkingOnly |
사용자 자격 증명이 네트워크 리소스에만 사용되는지 여부를 나타내는 값을 가져오거나 설정합니다. |
| UserName |
프로세스를 시작할 때 사용할 사용자 이름을 가져오거나 설정합니다. UPN 형식 |
| UseShellExecute |
운영 체제 셸을 사용하여 프로세스를 시작할지 여부를 나타내는 값을 가져오거나 설정합니다. |
| Verb |
속성에 지정된 FileName 애플리케이션 또는 문서를 열 때 사용할 동사를 가져오거나 설정합니다. |
| Verbs |
속성에서 지정한 파일 형식과 연결된 동사 집합을 FileName 가져옵니다. |
| WindowStyle |
프로세스가 시작될 때 사용할 창 상태를 가져오거나 설정합니다. |
| WorkingDirectory |
속성이 UseShellExecute 있으면 |
메서드
| Name | Description |
|---|---|
| Equals(Object) |
지정된 개체가 현재 개체와 같은지 여부를 확인합니다. (다음에서 상속됨 Object) |
| GetHashCode() |
기본 해시 함수로 사용됩니다. (다음에서 상속됨 Object) |
| GetType() |
현재 인스턴스의 Type 가져옵니다. (다음에서 상속됨 Object) |
| MemberwiseClone() |
현재 Object단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
| ToString() |
현재 개체를 나타내는 문자열을 반환합니다. (다음에서 상속됨 Object) |