다음을 통해 공유


Process.Start 메서드

정의

프로세스 리소스를 시작하고 구성 요소와 Process 연결합니다.

오버로드

Name Description
Start(String, String, String, SecureString, String)

애플리케이션의 이름, 명령줄 인수 집합, 사용자 이름, 암호 및 도메인을 지정하고 리소스를 새 Process 구성 요소와 연결하여 프로세스 리소스를 시작합니다.

Start(String, String, SecureString, String)

애플리케이션의 이름, 사용자 이름, 암호 및 도메인을 지정하여 프로세스 리소스를 시작하고 리소스를 새 Process 구성 요소와 연결합니다.

Start(String, String)

애플리케이션의 이름과 명령줄 인수 집합을 지정하여 프로세스 리소스를 시작하고 리소스를 새 Process 구성 요소와 연결합니다.

Start(String)

문서 또는 애플리케이션 파일의 이름을 지정하여 프로세스 리소스를 시작하고 리소스를 새 Process 구성 요소와 연결합니다.

Start(ProcessStartInfo)

프로세스 시작 정보(예: 시작할 프로세스의 파일 이름)를 포함하는 매개 변수에 의해 지정된 프로세스 리소스를 시작하고 리소스를 새 Process 구성 요소와 연결합니다.

Start()

Process 구성 요소의 속성에 지정된 프로세스 리소스를 StartInfo 시작(또는 다시 사용)하고 구성 요소와 연결합니다.

Start(String, IEnumerable<String>)

애플리케이션의 이름과 명령줄 인수 집합을 지정하여 프로세스 리소스를 시작합니다.

Start(String, String, String, SecureString, String)

Source:
Process.Unix.cs
Source:
Process.Unix.cs
Source:
Process.Unix.cs
Source:
Process.Unix.cs
Source:
Process.Unix.cs

Important

이 API는 CLS 규격이 아닙니다.

애플리케이션의 이름, 명령줄 인수 집합, 사용자 이름, 암호 및 도메인을 지정하고 리소스를 새 Process 구성 요소와 연결하여 프로세스 리소스를 시작합니다.

public:
 static System::Diagnostics::Process ^ Start(System::String ^ fileName, System::String ^ arguments, System::String ^ userName, System::Security::SecureString ^ password, System::String ^ domain);
[System.CLSCompliant(false)]
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static System.Diagnostics.Process? Start(string fileName, string arguments, string userName, System.Security.SecureString password, string domain);
[System.CLSCompliant(false)]
public static System.Diagnostics.Process Start(string fileName, string arguments, string userName, System.Security.SecureString password, string domain);
public static System.Diagnostics.Process Start(string fileName, string arguments, string userName, System.Security.SecureString password, string domain);
[<System.CLSCompliant(false)>]
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Start : string * string * string * System.Security.SecureString * string -> System.Diagnostics.Process
[<System.CLSCompliant(false)>]
static member Start : string * string * string * System.Security.SecureString * string -> System.Diagnostics.Process
static member Start : string * string * string * System.Security.SecureString * string -> System.Diagnostics.Process
Public Shared Function Start (fileName As String, arguments As String, userName As String, password As SecureString, domain As String) As Process

매개 변수

fileName
String

프로세스에서 실행할 애플리케이션 파일의 이름입니다.

arguments
String

프로세스를 시작할 때 전달할 명령줄 인수입니다.

userName
String

프로세스를 시작할 때 사용할 사용자 이름입니다.

password
SecureString

SecureString 프로세스를 시작할 때 사용할 암호가 들어 있는 A입니다.

domain
String

프로세스를 시작할 때 사용할 도메인입니다.

반환

프로세스 리소스와 연결된 새 Process 리소스이거나 null 프로세스 리소스가 시작되지 않은 경우 동일한 프로세스의 이미 실행 중인 인스턴스와 함께 시작된 새 프로세스는 다른 프로세스와 독립적입니다. 또한 Start는 해당 HasExited 속성이 이미 설정된 null이 아닌 프로세스를 반환할 true수 있습니다. 이 경우 시작된 프로세스에서 기존 인스턴스를 활성화한 다음 종료했을 수 있습니다.

특성

예외

파일 이름을 지정하지 않았습니다.

연결된 파일을 열 때 오류가 발생했습니다.

-또는-

지정된 fileName 파일을 찾을 수 없습니다.

-또는-

인수의 길이와 연결된 파일의 전체 경로 길이가 2080을 초과합니다. 이 예외와 관련된 오류 메시지는 다음 중 하나일 수 있습니다. "시스템 호출에 전달된 데이터 영역이 너무 작습니다." 또는 "액세스가 거부되었습니다."

프로세스 개체가 이미 삭제되었습니다.

이 멤버는 Linux 또는 macOS에서 지원되지 않습니다(.NET Core에만 해당).

설명

이 오버로드를 사용하여 파일 이름, 명령줄 인수, 사용자 이름, 암호 및 도메인을 지정하여 새 프로세스 및 기본 스레드를 만듭니다. 그런 다음, 새 프로세스는 지정된 자격 증명(사용자, 도메인 및 암호)의 보안 컨텍스트에서 지정된 실행 파일을 실행합니다.

중요합니다

신뢰할 수 없는 데이터로 이 메서드를 호출하는 것은 보안 위험입니다. 신뢰할 수 있는 데이터로만 이 메서드를 호출합니다. 자세한 내용은 모든 입력 유효성 검사참조하세요.

메모

실행 파일이 원격 드라이브에 있는 경우 연결된 드라이브 문자가 아닌 URI(Uniform Resource Identifier)를 사용하여 네트워크 공유를 식별해야 합니다.

메모

시작할 실행 파일의 주소가 URL인 경우 프로세스가 시작 null 되지 않고 반환됩니다.

이 오버로드를 사용하면 먼저 새 Process 인스턴스를 만들지 않고 프로세스를 시작할 수 있습니다. 오버로드는 새 Process 인스턴스를 만들고, 속성의 , Arguments, UserNamePasswordDomain 속성을 StartInfo 설정하고FileName, 인스턴스를 호출하는 Start 명시적 단계에 대한 Process 대안입니다.

마찬가지로 실행 대화 상자에서 .exe 확장명을 사용하거나 사용하지 않고 실행 파일 이름을 수락할 수 있는 것과 동일한 방식으로 매개 변수에서 .exe 확장명은 선택 사항 fileName 입니다. 예를 들어 매개 변수를 fileName "Notepad.exe" 또는 "메모장"으로 설정할 수 있습니다. 매개 변수가 fileName 실행 파일을 나타내는 경우 매개 변수는 arguments 작업할 파일(예: 텍스트 파일) Notepad.exe myfile.txt을 나타낼 수 있습니다.

메모

파일 이름은 매개 변수가 있는 오버로드 userNamepassworddomainStart 실행 파일을 나타내야 합니다.

프로세스를 시작하는 데 사용할 Start 때마다 프로세스를 닫아야 하거나 시스템 리소스가 손실될 위험이 있습니다. 사용하거나 Kill.를 사용하여 CloseMainWindow 프로세스를 닫습니다. 해당 속성을 사용하여 HasExited 프로세스가 이미 닫혔는지 확인할 수 있습니다.

적용 대상

Start(String, String, SecureString, String)

Source:
Process.Unix.cs
Source:
Process.Unix.cs
Source:
Process.Unix.cs
Source:
Process.Unix.cs
Source:
Process.Unix.cs

Important

이 API는 CLS 규격이 아닙니다.

애플리케이션의 이름, 사용자 이름, 암호 및 도메인을 지정하여 프로세스 리소스를 시작하고 리소스를 새 Process 구성 요소와 연결합니다.

public:
 static System::Diagnostics::Process ^ Start(System::String ^ fileName, System::String ^ userName, System::Security::SecureString ^ password, System::String ^ domain);
[System.CLSCompliant(false)]
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static System.Diagnostics.Process? Start(string fileName, string userName, System.Security.SecureString password, string domain);
[System.CLSCompliant(false)]
public static System.Diagnostics.Process Start(string fileName, string userName, System.Security.SecureString password, string domain);
public static System.Diagnostics.Process Start(string fileName, string userName, System.Security.SecureString password, string domain);
[<System.CLSCompliant(false)>]
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Start : string * string * System.Security.SecureString * string -> System.Diagnostics.Process
[<System.CLSCompliant(false)>]
static member Start : string * string * System.Security.SecureString * string -> System.Diagnostics.Process
static member Start : string * string * System.Security.SecureString * string -> System.Diagnostics.Process
Public Shared Function Start (fileName As String, userName As String, password As SecureString, domain As String) As Process

매개 변수

fileName
String

프로세스에서 실행할 애플리케이션 파일의 이름입니다.

userName
String

프로세스를 시작할 때 사용할 사용자 이름입니다.

password
SecureString

SecureString 프로세스를 시작할 때 사용할 암호가 들어 있는 A입니다.

domain
String

프로세스를 시작할 때 사용할 도메인입니다.

반환

프로세스 리소스와 연결된 새 Process 리소스이거나 null 프로세스 리소스가 시작되지 않은 경우 동일한 프로세스의 이미 실행 중인 인스턴스와 함께 시작된 새 프로세스는 다른 프로세스와 독립적입니다. 또한 Start는 해당 HasExited 속성이 이미 설정된 null이 아닌 프로세스를 반환할 true수 있습니다. 이 경우 시작된 프로세스에서 기존 인스턴스를 활성화한 다음 종료했을 수 있습니다.

특성

예외

파일 이름을 지정하지 않았습니다.

연결된 파일을 여는 동안 오류가 발생했습니다.

-또는-

지정된 fileName 파일을 찾을 수 없습니다.

프로세스 개체가 이미 삭제되었습니다.

이 멤버는 Linux 또는 macOS에서 지원되지 않습니다(.NET Core에만 해당).

예제

다음 코드 예제에서는 이 오버로드를 사용하여 실행 파일을 시작하는 방법을 보여 줍니다. 또한 실행할 수 없는 파일과 연결된 애플리케이션을 시작하려고 할 때 throw하는 방법을 보여 Win32Exception 줍니다.

// NOTE: This example requires a text.txt file file in your Documents folder
using System;
using System.Diagnostics;
using System.Security;
using System.ComponentModel;

class Example
{
    static void Main()
    {
        Console.Write("Enter your domain: ");
        string domain = Console.ReadLine();
        Console.Write("Enter you user name: ");
        string uname = Console.ReadLine();
        Console.Write("Enter your password: ");
        SecureString password = new SecureString();
        ConsoleKeyInfo key;
        do
        {
            key = Console.ReadKey(true);

            // Ignore any key out of range.
            if (((int)key.Key) >= 33 && ((int)key.Key <= 90) && key.Key != ConsoleKey.Enter)
            {
                // Append the character to the password.
                password.AppendChar(key.KeyChar);
                Console.Write("*");
            }
            // Exit if Enter key is pressed.
        } while (key.Key != ConsoleKey.Enter);
        Console.WriteLine();

        try
        {
            Console.WriteLine("\nTrying to launch NotePad using your login information...");
            Process.Start("notepad.exe", uname, password, domain);
        }
        catch (Win32Exception ex)
        {
            Console.WriteLine(ex.Message);
        }

        string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\";

        try
        {
            // The following call to Start succeeds if test.txt exists.
            Console.WriteLine("\nTrying to launch 'text.txt'...");
            Process.Start(path + "text.txt");
        }
        catch (Win32Exception ex)
        {
            Console.WriteLine(ex.Message);
        }

        try
        {
            // Attempting to start in a shell using this Start overload fails. This causes
            // the following exception, which is picked up in the catch block below:
            // The specified executable is not a valid application for this OS platform.
            Console.WriteLine("\nTrying to launch 'text.txt' with your login information...");
            Process.Start(path + "text.txt", uname, password, domain);
        }
        catch (Win32Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
        finally
        {
            password.Dispose();
        }
    }
}
// NOTE: This example requires a text.txt file file in your Documents folder
open System
open System.Diagnostics
open System.Security
open System.ComponentModel

printf "Enter your domain: "
let domain = stdin.ReadLine()
printf "Enter you user name: "
let uname = stdin.ReadLine()
printf "Enter your password: "
let password = new SecureString()

let mutable key = Console.ReadKey(true)

while key.Key <> ConsoleKey.Enter do
    // Ignore any key out of range.
    if int key.Key >= 33 && int key.Key <= 90 && key.Key <> ConsoleKey.Enter then
        // Append the character to the password.
        password.AppendChar key.KeyChar
        Console.Write "*"

    key <- Console.ReadKey(true)

printfn ""

try
    printfn "\nTrying to launch NotePad using your login information..."
    Process.Start("notepad.exe", uname, password, domain) |> ignore
with :? Win32Exception as ex ->
    printfn $"{ex.Message}"

let path = Environment.GetFolderPath Environment.SpecialFolder.MyDocuments + @"\"

try
    // The following call to Start succeeds if test.txt exists.
    printfn "\nTrying to launch 'text.txt'..."
    Process.Start $"{path}text.txt" |> ignore
with :? Win32Exception as ex ->
    printfn $"{ex.Message}"

try
    try
        // Attempting to start in a shell using this Start overload fails. This causes
        // the following exception, which is picked up in the catch block below:
        // The specified executable is not a valid application for this OS platform.
        printfn "\nTrying to launch 'text.txt' with your login information..."
        Process.Start($"{path}text.txt", uname, password, domain) |> ignore
    with :? Win32Exception as ex ->
        printfn $"{ex.Message}"
finally
    password.Dispose()
' This sample requires a text.txt file file in your documents folder.
' You'll also need to set the startup object in the project to Sub Main.
Imports System.Diagnostics
Imports System.Security
Imports System.ComponentModel

Module Program
    Sub Main()
        Console.Write("Enter your domain: ")
        Dim domain As String = Console.ReadLine()
        Console.Write("Enter you user name: ")
        Dim uname As String = Console.ReadLine()
        Console.Write("Enter your password: ")
        Dim password As New SecureString()
        Dim key As ConsoleKeyInfo
        Do
            key = Console.ReadKey(True)

            ' Ignore any key out of range.
            If key.Key >= 33 AndAlso key.Key <= 90 AndAlso key.Key <> ConsoleKey.Enter Then
                ' Append the character to the password.
                password.AppendChar(key.KeyChar)
                Console.Write("*")
            End If
            ' Exit if Enter key is pressed.
        Loop While key.Key <> ConsoleKey.Enter
        Console.WriteLine()

        Try
            Console.WriteLine(vbCrLf + "Trying to launch NotePad using your login information...")
            Process.Start("notepad.exe", uname, password, domain)
        Catch ex As Win32Exception
            Console.WriteLine(ex.Message)
        End Try

        Dim path As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\"

        Try
            ' The following call to Start succeeds if test.txt exists.
            Console.WriteLine(vbCrLf + "Trying to launch 'text.txt'...")
            Process.Start(path + "Text.txt")
        Catch ex As Win32Exception
            Console.WriteLine(ex.Message)
        End Try

        Try
            ' Attempting to start in a shell using this Start overload fails. This causes
            ' the following exception, which is picked up in the catch block below:
            ' The specified executable is not a valid application for this OS platform.
            Console.WriteLine(vbCrLf + "Trying to launch 'text.txt' with your login information...")
            Process.Start(path + "Text.txt", uname, password, domain)
        Catch ex As Win32Exception
            Console.WriteLine(ex.Message)
        Finally
            password.Dispose()
        End Try
    End Sub
End Module

설명

이 오버로드를 사용하여 파일 이름, 사용자 이름, 암호 및 도메인을 지정하여 새 프로세스 및 기본 스레드를 만듭니다. 그런 다음, 새 프로세스는 지정된 자격 증명(사용자, 도메인 및 암호)의 보안 컨텍스트에서 지정된 실행 파일을 실행합니다.

중요합니다

신뢰할 수 없는 데이터로 이 메서드를 호출하는 것은 보안 위험입니다. 신뢰할 수 있는 데이터로만 이 메서드를 호출합니다. 자세한 내용은 모든 입력 유효성 검사참조하세요.

메모

실행 파일이 원격 드라이브에 있는 경우 연결된 드라이브 문자가 아닌 URI(Uniform Resource Identifier)를 사용하여 네트워크 공유를 식별해야 합니다.

메모

시작할 실행 파일의 주소가 URL인 경우 프로세스가 시작 null 되지 않고 반환됩니다.

이 오버로드를 사용하면 먼저 새 Process 인스턴스를 만들지 않고 프로세스를 시작할 수 있습니다. 오버로드는 새 Process 인스턴스를 만들고, 속성의 , UserNameDomainPassword속성을 설정하고FileName, 인스턴스를 Process 호출하는 Start 명시적 단계의 StartInfo 대안입니다.

마찬가지로 실행 대화 상자에서 .exe 확장명을 사용하거나 사용하지 않고 실행 파일 이름을 수락할 수 있는 것과 동일한 방식으로 매개 변수에서 .exe 확장명은 선택 사항 fileName 입니다. 예를 들어 매개 변수를 fileName "Notepad.exe" 또는 "메모장"으로 설정할 수 있습니다. 매개 변수가 fileName 실행 파일을 나타내는 경우 매개 변수는 arguments 작업할 파일(예: 텍스트 파일) Notepad.exe myfile.txt을 나타낼 수 있습니다.

메모

파일 이름은 매개 변수가 있는 오버로드 userNamepassworddomainStart 실행 파일을 나타내야 합니다.

프로세스를 시작하는 데 사용할 Start 때마다 프로세스를 닫아야 하거나 시스템 리소스가 손실될 위험이 있습니다. 사용하거나 Kill.를 사용하여 CloseMainWindow 프로세스를 닫습니다. 해당 속성을 사용하여 HasExited 프로세스가 이미 닫혔는지 확인할 수 있습니다.

적용 대상

Start(String, String)

Source:
Process.cs
Source:
Process.cs
Source:
Process.cs
Source:
Process.cs
Source:
Process.cs

애플리케이션의 이름과 명령줄 인수 집합을 지정하여 프로세스 리소스를 시작하고 리소스를 새 Process 구성 요소와 연결합니다.

public:
 static System::Diagnostics::Process ^ Start(System::String ^ fileName, System::String ^ arguments);
[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Diagnostics.Process Start(string fileName, string arguments);
public static System.Diagnostics.Process Start(string fileName, string arguments);
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Diagnostics.Process Start(string fileName, string arguments);
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member Start : string * string -> System.Diagnostics.Process
static member Start : string * string -> System.Diagnostics.Process
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member Start : string * string -> System.Diagnostics.Process
Public Shared Function Start (fileName As String, arguments As String) As Process

매개 변수

fileName
String

프로세스에서 실행할 애플리케이션 파일의 이름입니다.

arguments
String

프로세스를 시작할 때 전달할 명령줄 인수입니다.

반환

프로세스 리소스와 연결된 새 Process 리소스이거나 null 프로세스 리소스가 시작되지 않은 경우 동일한 프로세스의 이미 실행 중인 인스턴스와 함께 시작된 새 프로세스는 다른 프로세스와 독립적입니다. 또한 Start는 해당 HasExited 속성이 이미 설정된 null이 아닌 프로세스를 반환할 true수 있습니다. 이 경우 시작된 프로세스에서 기존 인스턴스를 활성화한 다음 종료했을 수 있습니다.

특성

예외

fileName 또는 arguments 매개 변수가 .입니다null.

연결된 파일을 열 때 오류가 발생했습니다.

-또는-

지정된 fileName 파일을 찾을 수 없습니다.

-또는-

인수 길이와 프로세스의 전체 경로 길이 합계가 2080을 초과합니다. 이 예외와 관련된 오류 메시지는 다음 중 하나일 수 있습니다. "시스템 호출에 전달된 데이터 영역이 너무 작습니다." 또는 "액세스가 거부되었습니다."

프로세스 개체가 이미 삭제되었습니다.

PATH 환경 변수에는 따옴표를 포함하는 문자열이 있습니다.

예제

다음 예제에서는 먼저 Internet Explorer의 인스턴스를 생성하고 브라우저에 즐겨찾기 폴더의 내용을 표시합니다. 그런 다음 Internet Explorer의 다른 인스턴스를 시작하고 일부 특정 페이지 또는 사이트를 표시합니다. 마지막으로 특정 사이트로 이동하는 동안 창을 최소화하여 Internet Explorer를 시작합니다.

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();
        }
    }
}
module processstartstatic

open System
open System.Diagnostics

// Opens the Internet Explorer application.
let openApplication (myFavoritesPath: string) =
    // Start Internet Explorer. Defaults to the home page.
    Process.Start "IExplore.exe" |> ignore

    // Display the contents of the favorites folder in the browser.
    Process.Start myFavoritesPath |> ignore

// Opens urls and .html documents using Internet Explorer.
let openWithArguments () =
    // url's are not considered documents. They can only be opened
    // by passing them as arguments.
    Process.Start("IExplore.exe", "www.northwindtraders.com") |> ignore

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

// Uses the ProcessStartInfo class to start new processes,
// both in a minimized mode.
let openWithStartInfo () =
    let startInfo = ProcessStartInfo "IExplore.exe"
    startInfo.WindowStyle <- ProcessWindowStyle.Minimized

    Process.Start startInfo |> ignore

    startInfo.Arguments <- "www.northwindtraders.com"

    Process.Start startInfo |> ignore

// Get the path that stores favorite links.
let myFavoritesPath = Environment.GetFolderPath Environment.SpecialFolder.Favorites

openApplication myFavoritesPath
openWithArguments ()
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

설명

이 오버로드를 사용하여 파일 이름 및 명령줄 인수를 지정하여 프로세스 리소스를 시작합니다. 오버로드는 리소스를 새 Process 개체와 연결합니다.

중요합니다

신뢰할 수 없는 데이터로 이 메서드를 호출하는 것은 보안 위험입니다. 신뢰할 수 있는 데이터로만 이 메서드를 호출합니다. 자세한 내용은 모든 입력 유효성 검사참조하세요.

메모

시작할 실행 파일의 주소가 URL인 경우 프로세스가 시작 null 되지 않고 반환됩니다.

이 오버로드를 사용하면 먼저 새 Process 인스턴스를 만들지 않고 프로세스를 시작할 수 있습니다. 오버로드는 새 Process 인스턴스를 만들고, 속성의 멤버 및 Arguments 멤버를 FileName 설정하고, 인스턴스를 StartInfo 호출하는 Start 명시적 단계에 대한 Process 대안입니다.

파일 이름과 인수를 지정하여 프로세스를 시작하는 것은 Windows Start 메뉴의 대화 상자에 파일 이름 및 명령줄 인수 Run 를 입력하는 것과 비슷합니다. 따라서 파일 이름은 실행 파일을 나타낼 필요가 없습니다. 확장이 시스템에 설치된 애플리케이션과 연결된 파일 형식일 수 있습니다. 예를 들어 메모장과 같은 편집기에서 텍스트 파일을 연결한 경우 파일 이름에 .txt 확장명이 있거나 Microsoft Word와 같은 단어 처리 도구와 .doc 파일을 연결한 경우 .doc 있을 수 있습니다. 마찬가지로 대화 상자에서 .exe 확장명을 포함하거나 사용하지 않고 실행 파일 이름을 수락할 수 있는 것과 동일한 방식으로 Run 매개 변수에서 .exe 확장명은 선택 사항 fileName 입니다. 예를 들어 매개 변수를 fileName "Notepad.exe" 또는 "메모장"으로 설정할 수 있습니다. 매개 변수가 fileName 실행 파일을 나타내는 경우 매개 변수는 arguments 작업할 파일(예: 텍스트 파일) Notepad.exe myfile.txt을 나타낼 수 있습니다. 매개 변수가 fileName 명령(.cmd) 파일을 arguments 나타내는 경우 매개 변수에 "/c" 또는 "/k" 인수를 포함해야 명령 창이 종료되거나 완료 후에도 유지되는지 여부를 지정할 수 있습니다.

다른 오버로드와 달리 매개 변수가 없는 오버로드는 Start 멤버가 static 아닙니다. 이미 인스턴스를 Process 만들고 시작 정보(파일 이름 포함)를 지정하고 프로세스 리소스를 시작하고 기존 인스턴스와 연결하려는 경우 해당 오버로드를 Process 사용합니다. 기존 구성 요소에 static 대한 프로세스를 시작하는 대신 새 Process 구성 요소를 만들려는 경우 오버로드 중 하나를 사용합니다. 이 오버로드와 매개 변수가 없는 오버로드를 모두 사용하여 시작할 프로세스 리소스의 파일 이름과 전달할 명령줄 인수를 지정할 수 있습니다.

따옴표를 사용하여 시스템에 선언된 경로 변수가 있는 경우 해당 위치에서 찾은 프로세스를 시작할 때 해당 경로를 정규화해야 합니다. 그렇지 않으면 시스템에서 경로를 찾을 수 없습니다. 예를 들어 경로에 없는 경우 c:\mypath 따옴표를 path = %path%;"c:\mypath"사용하여 추가합니다. 시작 시 프로세스를 c:\mypath 완전히 한정해야 합니다.

메모

ASP.NET 웹 페이지 및 서버 제어 코드는 웹 서버의 ASP.NET 작업자 프로세스 컨텍스트에서 실행됩니다. ASP.NET 웹 페이지 또는 서버 컨트롤에서 메서드를 사용하는 Start 경우 제한된 권한으로 웹 서버에서 새 프로세스가 실행됩니다. 프로세스는 클라이언트 브라우저와 동일한 컨텍스트에서 시작되지 않으며 사용자 데스크톱에 액세스할 수 없습니다.

프로세스를 시작하는 데 사용할 Start 때마다 프로세스를 닫아야 하거나 시스템 리소스가 손실될 위험이 있습니다. 사용하거나 Kill.를 사용하여 CloseMainWindow 프로세스를 닫습니다. 해당 속성을 사용하여 HasExited 프로세스가 이미 닫혔는지 확인할 수 있습니다.

여기에서 관리되는 스레드의 아파트 상태에 대한 참고 사항이 필요합니다. true 프로세스 구성 요소의 StartInfo 속성에 있는 경우 UseShellExecute 메서드의 특성을 [STAThread]main() 설정하여 애플리케이션에서 스레딩 모델을 설정했는지 확인합니다. 그렇지 않으면 관리되는 스레드가 상태에 있거나 상태에 배치 MTAunknown 수 있으며, 그 중 후자는 존재trueUseShellExecute 충돌합니다. 일부 방법에는 아파트 상태가 아닌 것이 필요합니다 unknown. 상태가 명시적으로 설정되지 않은 경우 애플리케이션에서 이러한 메서드를 발견하면 기본값 MTA으로 설정되고, 설정되면 아파트 상태를 변경할 수 없습니다. 그러나 MTA 운영 체제 셸이 스레드를 관리할 때 예외가 throw됩니다.

추가 정보

적용 대상

Start(String)

Source:
Process.cs
Source:
Process.cs
Source:
Process.cs
Source:
Process.cs
Source:
Process.cs

문서 또는 애플리케이션 파일의 이름을 지정하여 프로세스 리소스를 시작하고 리소스를 새 Process 구성 요소와 연결합니다.

public:
 static System::Diagnostics::Process ^ Start(System::String ^ fileName);
[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Diagnostics.Process Start(string fileName);
public static System.Diagnostics.Process Start(string fileName);
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Diagnostics.Process Start(string fileName);
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member Start : string -> System.Diagnostics.Process
static member Start : string -> System.Diagnostics.Process
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member Start : string -> System.Diagnostics.Process
Public Shared Function Start (fileName As String) As Process

매개 변수

fileName
String

프로세스에서 실행할 문서 또는 응용 프로그램 파일의 이름입니다.

반환

프로세스 리소스와 연결된 새 Process 리소스이거나 null 프로세스 리소스가 시작되지 않은 경우 동일한 프로세스의 이미 실행 중인 인스턴스와 함께 시작된 새 프로세스는 다른 프로세스와 독립적입니다. 또한 Start는 해당 HasExited 속성이 이미 설정된 null이 아닌 프로세스를 반환할 true수 있습니다. 이 경우 시작된 프로세스에서 기존 인스턴스를 활성화한 다음 종료했을 수 있습니다.

특성

예외

연결된 파일을 열 때 오류가 발생했습니다.

-또는-

지정된 fileName 파일을 찾을 수 없습니다.

프로세스 개체가 이미 삭제되었습니다.

PATH 환경 변수에는 따옴표를 포함하는 문자열이 있습니다.

예제

다음 예제에서는 먼저 Internet Explorer의 인스턴스를 생성하고 브라우저에 즐겨찾기 폴더의 내용을 표시합니다. 그런 다음 Internet Explorer의 다른 인스턴스를 시작하고 일부 특정 페이지 또는 사이트를 표시합니다. 마지막으로 특정 사이트로 이동하는 동안 창을 최소화하여 Internet Explorer를 시작합니다.

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();
        }
    }
}
module processstartstatic

open System
open System.Diagnostics

// Opens the Internet Explorer application.
let openApplication (myFavoritesPath: string) =
    // Start Internet Explorer. Defaults to the home page.
    Process.Start "IExplore.exe" |> ignore

    // Display the contents of the favorites folder in the browser.
    Process.Start myFavoritesPath |> ignore

// Opens urls and .html documents using Internet Explorer.
let openWithArguments () =
    // url's are not considered documents. They can only be opened
    // by passing them as arguments.
    Process.Start("IExplore.exe", "www.northwindtraders.com") |> ignore

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

// Uses the ProcessStartInfo class to start new processes,
// both in a minimized mode.
let openWithStartInfo () =
    let startInfo = ProcessStartInfo "IExplore.exe"
    startInfo.WindowStyle <- ProcessWindowStyle.Minimized

    Process.Start startInfo |> ignore

    startInfo.Arguments <- "www.northwindtraders.com"

    Process.Start startInfo |> ignore

// Get the path that stores favorite links.
let myFavoritesPath = Environment.GetFolderPath Environment.SpecialFolder.Favorites

openApplication myFavoritesPath
openWithArguments ()
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

설명

이 오버로드를 사용하여 파일 이름을 지정하여 프로세스 리소스를 시작합니다. 오버로드는 리소스를 새 Process 개체와 연결합니다.

중요합니다

신뢰할 수 없는 데이터로 이 메서드를 호출하는 것은 보안 위험입니다. 신뢰할 수 있는 데이터로만 이 메서드를 호출합니다. 자세한 내용은 모든 입력 유효성 검사참조하세요.

메모

시작할 실행 파일의 주소가 URL인 경우 프로세스가 시작 null 되지 않고 반환됩니다.

이 오버로드를 사용하면 먼저 새 Process 인스턴스를 만들지 않고 프로세스를 시작할 수 있습니다. 오버로드는 새 Process 인스턴스를 만들고, 속성의 StartInfo 멤버를 설정하고, 인스턴스를 FileName 호출 Start 하는 명시적 단계에 대한 Process 대안입니다.

원래 애플리케이션을 설치한 위치(예: 웹 주소)로 매개 변수를 설정 fileName 하여 ClickOnce 애플리케이션을 시작할 수 있습니다. 하드 드라이브에 설치된 위치를 지정하여 ClickOnce 애플리케이션을 시작하지 마세요.

파일 이름을 지정하여 프로세스를 시작하는 것은 Windows Start 메뉴의 대화 상자에 정보를 Run 입력하는 것과 비슷합니다. 따라서 파일 이름은 실행 파일을 나타낼 필요가 없습니다. 확장이 시스템에 설치된 애플리케이션과 연결된 파일 형식일 수 있습니다. 예를 들어 메모장과 같은 편집기에서 텍스트 파일을 연결한 경우 파일 이름에 .txt 확장명이 있거나 Microsoft Word와 같은 단어 처리 도구와 .doc 파일을 연결한 경우 .doc 있을 수 있습니다. 마찬가지로 대화 상자에서 .exe 확장명을 포함하거나 사용하지 않고 실행 파일 이름을 수락할 수 있는 것과 동일한 방식으로 Run 매개 변수에서 .exe 확장명은 선택 사항 fileName 입니다. 예를 들어 매개 변수를 fileName "Notepad.exe" 또는 "메모장"으로 설정할 수 있습니다.

이 오버로드는 프로세스에 대한 명령줄 인수를 허용하지 않습니다. 프로세스에 대해 하나 이상의 명령줄 인수를 지정해야 하는 경우 오버로드를 Process.Start(String, String) 사용합니다Process.Start(ProcessStartInfo).

다른 오버로드와 달리 매개 변수가 없는 오버로드는 Start 멤버가 static 아닙니다. 이미 인스턴스를 Process 만들고 시작 정보(파일 이름 포함)를 지정하고 프로세스 리소스를 시작하고 기존 인스턴스와 연결하려는 경우 해당 오버로드를 Process 사용합니다. 기존 구성 요소에 static 대한 프로세스를 시작하는 대신 새 Process 구성 요소를 만들려는 경우 오버로드 중 하나를 사용합니다. 이 오버로드와 매개 변수가 없는 오버로드를 모두 사용하여 시작할 프로세스 리소스의 파일 이름을 지정할 수 있습니다.

따옴표를 사용하여 시스템에 선언된 경로 변수가 있는 경우 해당 위치에서 찾은 프로세스를 시작할 때 해당 경로를 정규화해야 합니다. 그렇지 않으면 시스템에서 경로를 찾을 수 없습니다. 예를 들어 경로에 없는 경우 c:\mypath 따옴표를 path = %path%;"c:\mypath"사용하여 추가합니다. 시작 시 프로세스를 c:\mypath 완전히 한정해야 합니다.

메모

ASP.NET 웹 페이지 및 서버 제어 코드는 웹 서버의 ASP.NET 작업자 프로세스 컨텍스트에서 실행됩니다. ASP.NET 웹 페이지 또는 서버 컨트롤에서 메서드를 사용하는 Start 경우 제한된 권한으로 웹 서버에서 새 프로세스가 실행됩니다. 프로세스는 클라이언트 브라우저와 동일한 컨텍스트에서 시작되지 않으며 사용자 데스크톱에 액세스할 수 없습니다.

프로세스를 시작하는 데 사용할 Start 때마다 프로세스를 닫아야 하거나 시스템 리소스가 손실될 위험이 있습니다. 사용하거나 Kill.를 사용하여 CloseMainWindow 프로세스를 닫습니다. 해당 속성을 사용하여 HasExited 프로세스가 이미 닫혔는지 확인할 수 있습니다.

여기에서 관리되는 스레드의 아파트 상태에 대한 참고 사항이 필요합니다. true 프로세스 구성 요소의 StartInfo 속성에 있는 경우 UseShellExecute 메서드의 특성을 [STAThread]main() 설정하여 애플리케이션에서 스레딩 모델을 설정했는지 확인합니다. 그렇지 않으면 관리되는 스레드가 상태에 있거나 상태에 배치 MTAunknown 수 있으며, 그 중 후자는 존재trueUseShellExecute 충돌합니다. 일부 방법에는 아파트 상태가 아닌 것이 필요합니다 unknown. 상태가 명시적으로 설정되지 않은 경우 애플리케이션에서 이러한 메서드를 발견하면 기본값 MTA으로 설정되고, 설정되면 아파트 상태를 변경할 수 없습니다. 그러나 MTA 운영 체제 셸이 스레드를 관리할 때 예외가 throw됩니다.

추가 정보

적용 대상

Start(ProcessStartInfo)

Source:
Process.cs
Source:
Process.cs
Source:
Process.cs
Source:
Process.cs
Source:
Process.cs

프로세스 시작 정보(예: 시작할 프로세스의 파일 이름)를 포함하는 매개 변수에 의해 지정된 프로세스 리소스를 시작하고 리소스를 새 Process 구성 요소와 연결합니다.

public:
 static System::Diagnostics::Process ^ Start(System::Diagnostics::ProcessStartInfo ^ startInfo);
[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Diagnostics.Process? Start(System.Diagnostics.ProcessStartInfo startInfo);
public static System.Diagnostics.Process? Start(System.Diagnostics.ProcessStartInfo startInfo);
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Diagnostics.Process? Start(System.Diagnostics.ProcessStartInfo startInfo);
public static System.Diagnostics.Process Start(System.Diagnostics.ProcessStartInfo startInfo);
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member Start : System.Diagnostics.ProcessStartInfo -> System.Diagnostics.Process
static member Start : System.Diagnostics.ProcessStartInfo -> System.Diagnostics.Process
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member Start : System.Diagnostics.ProcessStartInfo -> System.Diagnostics.Process
Public Shared Function Start (startInfo As ProcessStartInfo) As Process

매개 변수

startInfo
ProcessStartInfo

ProcessStartInfo 파일 이름 및 명령줄 인수를 포함하여 프로세스를 시작하는 데 사용되는 정보가 포함된 정보입니다.

반환

프로세스 리소스와 연결된 새 Process 리소스이거나 null 프로세스 리소스가 시작되지 않은 경우 동일한 프로세스의 이미 실행 중인 인스턴스와 함께 시작된 새 프로세스는 다른 프로세스와 독립적입니다. 또한 Start는 해당 HasExited 속성이 이미 설정된 null이 아닌 프로세스를 반환할 true수 있습니다. 이 경우 시작된 프로세스에서 기존 인스턴스를 활성화한 다음 종료했을 수 있습니다.

특성

예외

매개 변수의 FileName 속성에 startInfo 파일 이름이 지정되지 않았습니다.

-또는-

UseShellExecute 매개 변수의 startInfo 속성이 trueRedirectStandardInput, RedirectStandardOutput또는 RedirectStandardError 속성도 true있습니다.

-또는-

UseShellExecute 매개 변수의 startInfo 속성이 true 고 속성이 UserName 비어 있지 않거나 null 비어 있거나 속성이 Password 아닙니다null.

매개 변수는 startInfo .입니다 null.

프로세스 개체가 이미 삭제되었습니다.

연결된 파일을 열 때 오류가 발생했습니다.

-또는-

매개 변수의 FileName 속성에 startInfo 지정된 파일을 찾을 수 없습니다.

-또는-

인수 길이와 프로세스의 전체 경로 길이 합계가 2080을 초과합니다. 이 예외와 관련된 오류 메시지는 다음 중 하나일 수 있습니다. "시스템 호출에 전달된 데이터 영역이 너무 작습니다." 또는 "액세스가 거부되었습니다."

Nano Server(.NET Core만 해당)와 같은 셸 지원이 없는 운영 체제에서는 지원되지 않는 방법입니다.

예제

다음 예제에서는 먼저 Internet Explorer의 인스턴스를 생성하고 브라우저에 즐겨찾기 폴더의 내용을 표시합니다. 그런 다음 Internet Explorer의 다른 인스턴스를 시작하고 일부 특정 페이지 또는 사이트를 표시합니다. 마지막으로 특정 사이트로 이동하는 동안 창을 최소화하여 Internet Explorer를 시작합니다.

이 메서드의 다른 용도에 대한 추가 예제는 클래스의 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();
        }
    }
}
module processstartstatic

open System
open System.Diagnostics

// Opens the Internet Explorer application.
let openApplication (myFavoritesPath: string) =
    // Start Internet Explorer. Defaults to the home page.
    Process.Start "IExplore.exe" |> ignore

    // Display the contents of the favorites folder in the browser.
    Process.Start myFavoritesPath |> ignore

// Opens urls and .html documents using Internet Explorer.
let openWithArguments () =
    // url's are not considered documents. They can only be opened
    // by passing them as arguments.
    Process.Start("IExplore.exe", "www.northwindtraders.com") |> ignore

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

// Uses the ProcessStartInfo class to start new processes,
// both in a minimized mode.
let openWithStartInfo () =
    let startInfo = ProcessStartInfo "IExplore.exe"
    startInfo.WindowStyle <- ProcessWindowStyle.Minimized

    Process.Start startInfo |> ignore

    startInfo.Arguments <- "www.northwindtraders.com"

    Process.Start startInfo |> ignore

// Get the path that stores favorite links.
let myFavoritesPath = Environment.GetFolderPath Environment.SpecialFolder.Favorites

openApplication myFavoritesPath
openWithArguments ()
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 개체와 연결합니다.

중요합니다

신뢰할 수 없는 데이터로 이 메서드를 호출하는 것은 보안 위험입니다. 신뢰할 수 있는 데이터로만 이 메서드를 호출합니다. 자세한 내용은 모든 입력 유효성 검사참조하세요.

메모

시작할 실행 파일의 주소가 URL인 경우 프로세스가 시작 null 되지 않고 반환됩니다.

이 오버로드를 사용하면 먼저 새 Process 인스턴스를 만들지 않고 프로세스를 시작할 수 있습니다. 매개 변수와 함께 이 오버로드를 ProcessStartInfo 사용하는 것은 새 Process 인스턴스를 만들고, 속성을 StartInfo 설정하고, 인스턴스를 호출하는 Start 명시적 단계에 대한 Process 대안입니다.

인스턴스를 ProcessStartInfo 매개 변수로 사용하면 호출에 전달되는 내용을 가장 많이 제어하여 호출 Start 하여 프로세스를 시작할 수 있습니다. 파일 이름이나 파일 이름 및 인수만 전달해야 하는 경우 새 ProcessStartInfo 인스턴스를 만들 필요는 없습니다. 설정해야 하는 유일한 Process.StartInfo 속성은 속성입니다 FileName . 이 속성은 FileName 실행 파일을 나타낼 필요가 없습니다. 확장이 시스템에 설치된 애플리케이션과 연결된 파일 형식일 수 있습니다. 예를 들어 FileName 메모장과 같은 편집기에서 텍스트 파일을 연결한 경우 속성에 .txt 확장명이 있거나 Microsoft Word와 같은 단어 처리 도구와 .doc 파일을 연결한 경우 .doc 확장명이 있을 수 있습니다.

원래 애플리케이션을 설치한 위치(예: 웹 주소)를 지정하여 ClickOnce 애플리케이션을 시작할 수 있습니다. 하드 드라이브에 설치된 위치를 지정하여 ClickOnce 애플리케이션을 시작하지 마세요.

인스턴스의 ProcessStartInfo.UserNameStartInfo 속성과 ProcessStartInfo.Password 속성을 설정하면 관리 CreateProcessWithLogonW 되지 않는 함수가 호출되어 속성 값이거나 ProcessStartInfo.WindowStyle 속성 값 true 이 있더라도 ProcessStartInfo.CreateNoWindow 새 창에서 프로세스를 시작합니다ProcessWindowStyle.Hidden. 속성이 ProcessStartInfo.Domainnull면 속성이 ProcessStartInfo.UserName UPN 형식이어야 하며 사용자@DNS_domain_name.

다른 오버로드와 달리 매개 변수가 없는 오버로드는 Start 멤버가 static 아닙니다. 이미 인스턴스를 Process 만들고 시작 정보(파일 이름 포함)를 지정하고 프로세스 리소스를 시작하고 기존 인스턴스와 연결하려는 경우 해당 오버로드를 Process 사용합니다. 기존 구성 요소에 static 대한 프로세스를 시작하는 대신 새 Process 구성 요소를 만들려는 경우 오버로드 중 하나를 사용합니다. 이 오버로드와 매개 변수가 없는 오버로드를 모두 사용하면 인스턴스를 사용하여 ProcessStartInfo 프로세스 리소스에 대한 시작 정보를 지정할 수 있습니다.

따옴표를 사용하여 시스템에 선언된 경로 변수가 있는 경우 해당 위치에서 찾은 프로세스를 시작할 때 해당 경로를 정규화해야 합니다. 그렇지 않으면 시스템에서 경로를 찾을 수 없습니다. 예를 들어 경로에 없는 경우 c:\mypath 따옴표를 path = %path%;"c:\mypath"사용하여 추가합니다. 시작 시 프로세스를 c:\mypath 완전히 한정해야 합니다.

메모

ASP.NET 웹 페이지 및 서버 제어 코드는 웹 서버의 ASP.NET 작업자 프로세스 컨텍스트에서 실행됩니다. ASP.NET 웹 페이지 또는 서버 컨트롤에서 메서드를 사용하는 Start 경우 제한된 권한으로 웹 서버에서 새 프로세스가 실행됩니다. 프로세스는 클라이언트 브라우저와 동일한 컨텍스트에서 시작되지 않으며 사용자 데스크톱에 액세스할 수 없습니다.

프로세스를 시작하는 데 사용할 Start 때마다 프로세스를 닫아야 하거나 시스템 리소스가 손실될 위험이 있습니다. 사용하거나 Kill.를 사용하여 CloseMainWindow 프로세스를 닫습니다. 해당 속성을 사용하여 HasExited 프로세스가 이미 닫혔는지 확인할 수 있습니다.

여기에서 관리되는 스레드의 아파트 상태에 대한 참고 사항이 필요합니다. true 매개 변수에 있는 startInfo 경우 UseShellExecute 메서드의 특성을 [STAThread]main() 설정하여 애플리케이션에서 스레딩 모델을 설정했는지 확인합니다. 그렇지 않으면 관리되는 스레드가 상태에 있거나 상태에 배치 MTAunknown 수 있으며, 그 중 후자는 존재trueUseShellExecute 충돌합니다. 일부 방법에는 아파트 상태가 아닌 것이 필요합니다 unknown. 상태가 명시적으로 설정되지 않은 경우 애플리케이션에서 이러한 메서드를 발견하면 기본값 MTA으로 설정되고, 설정되면 아파트 상태를 변경할 수 없습니다. 그러나 MTA 운영 체제 셸이 스레드를 관리할 때 예외가 throw됩니다.

추가 정보

적용 대상

Start()

Source:
Process.cs
Source:
Process.cs
Source:
Process.cs
Source:
Process.cs
Source:
Process.cs

Process 구성 요소의 속성에 지정된 프로세스 리소스를 StartInfo 시작(또는 다시 사용)하고 구성 요소와 연결합니다.

public:
 bool Start();
[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public bool Start();
public bool Start();
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public bool Start();
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
member this.Start : unit -> bool
member this.Start : unit -> bool
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
member this.Start : unit -> bool
Public Function Start () As Boolean

반환

true 프로세스 리소스가 시작되면 이고, false 새 프로세스 리소스가 시작되지 않은 경우(예: 기존 프로세스를 다시 사용하는 경우)

특성

예외

구성 요소의 StartInfo.에 Process 파일 이름이 지정되지 않았습니다.

-또는-

속성의 멤버는 StartInfotrueUseShellExecute while RedirectStandardInput, RedirectStandardOutput또는 RedirectStandardError is입니다.true

연결된 파일을 여는 동안 오류가 발생했습니다.

프로세스 개체가 이미 삭제되었습니다.

Nano Server(.NET Core만 해당)와 같은 셸 지원이 없는 운영 체제에서는 지원되지 않는 방법입니다.

예제

다음 예제에서는 클래스의 인스턴스를 Process 사용하여 프로세스를 시작합니다.

using System;
using System.Diagnostics;
using System.ComponentModel;

namespace MyProcessSample
{
    class MyProcess
    {
        public static void Main()
        {
            try
            {
                using (Process myProcess = new Process())
                {
                    myProcess.StartInfo.UseShellExecute = false;
                    // You can start any process, HelloWorld is a do-nothing example.
                    myProcess.StartInfo.FileName = "C:\\HelloWorld.exe";
                    myProcess.StartInfo.CreateNoWindow = true;
                    myProcess.Start();
                    // This code assumes the process you are starting will terminate itself.
                    // Given that it is started without a window so you cannot terminate it
                    // on the desktop, it must terminate itself or you can do it programmatically
                    // from this application using the Kill method.
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}
open System.Diagnostics

try
    use myProcess = new Process()
    myProcess.StartInfo.UseShellExecute <- false
    // You can start any process, HelloWorld is a do-nothing example.
    myProcess.StartInfo.FileName <- @"C:\HelloWorld.exe"
    myProcess.StartInfo.CreateNoWindow <- true
    myProcess.Start() |> ignore
// This code assumes the process you are starting will terminate itself.
// Given that it is started without a window so you cannot terminate it
// on the desktop, it must terminate itself or you can do it programmatically
// from this application using the Kill method.
with e ->
    printfn $"{e.Message}"
Imports System.Diagnostics
Imports System.ComponentModel

Namespace MyProcessSample
    Class MyProcess
        Public Shared Sub Main()
            Try
                Using myProcess As New Process()

                    myProcess.StartInfo.UseShellExecute = False
                    ' You can start any process, HelloWorld is a do-nothing example.
                    myProcess.StartInfo.FileName = "C:\\HelloWorld.exe"
                    myProcess.StartInfo.CreateNoWindow = True
                    myProcess.Start()
                    ' This code assumes the process you are starting will terminate itself. 
                    ' Given that it is started without a window so you cannot terminate it 
                    ' on the desktop, it must terminate itself or you can do it programmatically
                    ' from this application using the Kill method.
                End Using
            Catch e As Exception
                Console.WriteLine((e.Message))
            End Try
        End Sub
    End Class
End Namespace

설명

이 오버로드를 사용하여 프로세스 리소스를 시작하고 현재 Process 구성 요소와 연결합니다. 반환 값 true 은 새 프로세스 리소스가 시작되었음을 나타냅니다. 속성의 StartInfo 멤버가 지정한 FileName 프로세스 리소스가 컴퓨터에서 이미 실행 중인 경우 추가 프로세스 리소스가 시작되지 않습니다. 대신 실행 중인 프로세스 리소스가 다시 사용되며 false 반환됩니다.

원래 애플리케이션을 설치한 위치(예: 웹 주소)를 지정하여 ClickOnce 애플리케이션을 시작할 수 있습니다. 하드 드라이브에 설치된 위치를 지정하여 ClickOnce 애플리케이션을 시작하지 마세요.

중요합니다

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

메모

Visual Studio를 사용하는 경우 이 메서드의 Start 오버로드는 구성 요소를 디자이너로 끌어온 후 코드에 삽입하는 Process 오버로드입니다. Properties 창을 사용하여 범주를 StartInfo 확장하고 속성에 적절한 값을 FileName 씁니다. 양식의 InitializeComponent 프로시저에 변경 내용이 표시됩니다.

이 오버로드는 Start 메서드가 static 아닙니다. 클래스의 Process 인스턴스에서 호출해야 합니다. 호출Start하기 전에 먼저 이 Process 인스턴스에 대한 속성 정보를 지정 StartInfo 해야 합니다. 이 정보는 시작할 프로세스 리소스를 결정하는 데 사용되기 때문입니다.

메서드의 Start 다른 오버로드는 멤버입니다 static . 메서드의 오버로드를 호출하기 전에 구성 요소의 Process 인스턴스를 만들 필요가 없습니다. 대신 클래스 자체를 호출 StartProcess 수 있으며 프로세스가 시작된 경우 새 Process 구성 요소가 만들어집니다. null 또는 프로세스가 다시 사용되면 반환됩니다. 프로세스 리소스는 메서드에서 반환 Start 되는 새 Process 구성 요소와 자동으로 연결됩니다.

멤버를 StartInfo 사용하여 Windows Start 메뉴의 Run 대화 상자 기능을 복제할 수 있습니다. 명령줄에 입력할 수 있는 모든 항목은 속성에서 적절한 값을 StartInfo 설정하여 시작할 수 있습니다. 설정해야 하는 유일한 StartInfo 속성은 속성입니다 FileName . 속성이 FileName 실행 파일일 필요는 없습니다. 확장이 시스템에 설치된 애플리케이션과 연결된 파일 형식일 수 있습니다. 예를 들어 FileName 메모장과 같은 편집기에서 텍스트 파일을 연결한 경우 속성에 .txt 확장명이 있거나 Microsoft Word와 같은 단어 처리 도구와 .doc 파일을 연결한 경우 .doc 확장명이 있을 수 있습니다.

명령줄에서 특정 형식의 파일에 대해 수행할 작업을 지정할 수 있습니다. 예를 들어 문서를 인쇄하거나 텍스트 파일을 편집할 수 있습니다. 속성의 멤버를 Verb 사용하여 이러한 작업을 지정합니다 StartInfo . 다른 형식의 파일의 경우 대화 상자에서 파일을 시작할 때 명령줄 인수를 Run 지정할 수 있습니다. 예를 들어 브라우저를 으로 지정하는 경우 URL을 인수로 FileName전달할 수 있습니다. 이러한 인수는 속성의 Arguments 멤버에 StartInfo 지정할 수 있습니다.

따옴표를 사용하여 시스템에 선언된 경로 변수가 있는 경우 해당 위치에서 찾은 프로세스를 시작할 때 해당 경로를 정규화해야 합니다. 그렇지 않으면 시스템에서 경로를 찾을 수 없습니다. 예를 들어 경로에 없는 경우 c:\mypath 따옴표를 path = %path%;"c:\mypath"사용하여 추가합니다. 시작 시 프로세스를 c:\mypath 완전히 한정해야 합니다.

메모

ASP.NET 웹 페이지 및 서버 제어 코드는 웹 서버의 ASP.NET 작업자 프로세스 컨텍스트에서 실행됩니다. ASP.NET 웹 페이지 또는 서버 컨트롤에서 메서드를 사용하는 Start 경우 제한된 권한으로 웹 서버에서 새 프로세스가 실행됩니다. 프로세스는 클라이언트 브라우저와 동일한 컨텍스트에서 시작되지 않으며 사용자 데스크톱에 액세스할 수 없습니다.

프로세스를 시작하는 데 사용할 Start 때마다 프로세스를 닫아야 하거나 시스템 리소스가 손실될 위험이 있습니다. 사용하거나 Kill.를 사용하여 CloseMainWindow 프로세스를 닫습니다. 해당 속성을 사용하여 HasExited 프로세스가 이미 닫혔는지 확인할 수 있습니다.

여기에서 관리되는 스레드의 아파트 상태에 대한 참고 사항이 필요합니다. true 프로세스 구성 요소의 StartInfo 속성에 있는 경우 UseShellExecute 메서드의 특성을 [STAThread]main() 설정하여 애플리케이션에서 스레딩 모델을 설정했는지 확인합니다. 그렇지 않으면 관리되는 스레드가 상태에 있거나 상태에 배치 MTAunknown 수 있으며, 그 중 후자는 존재trueUseShellExecute 충돌합니다. 일부 방법에는 아파트 상태가 아닌 것이 필요합니다 unknown. 상태가 명시적으로 설정되지 않은 경우 애플리케이션에서 이러한 메서드를 발견하면 기본값 MTA으로 설정되고, 설정되면 아파트 상태를 변경할 수 없습니다. 그러나 MTA 운영 체제 셸이 스레드를 관리할 때 예외가 throw됩니다.

추가 정보

적용 대상

Start(String, IEnumerable<String>)

Source:
Process.cs
Source:
Process.cs
Source:
Process.cs
Source:
Process.cs
Source:
Process.cs

애플리케이션의 이름과 명령줄 인수 집합을 지정하여 프로세스 리소스를 시작합니다.

public:
 static System::Diagnostics::Process ^ Start(System::String ^ fileName, System::Collections::Generic::IEnumerable<System::String ^> ^ arguments);
[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Diagnostics.Process Start(string fileName, System.Collections.Generic.IEnumerable<string> arguments);
public static System.Diagnostics.Process Start(string fileName, System.Collections.Generic.IEnumerable<string> arguments);
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Diagnostics.Process Start(string fileName, System.Collections.Generic.IEnumerable<string> arguments);
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member Start : string * seq<string> -> System.Diagnostics.Process
static member Start : string * seq<string> -> System.Diagnostics.Process
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member Start : string * seq<string> -> System.Diagnostics.Process
Public Shared Function Start (fileName As String, arguments As IEnumerable(Of String)) As Process

매개 변수

fileName
String

프로세스에서 실행할 문서 또는 응용 프로그램 파일의 이름입니다.

arguments
IEnumerable<String>

프로세스를 시작할 때 전달할 명령줄 인수입니다.

반환

프로세스 리소스와 연결된 새 Process 리소스이거나 null 프로세스 리소스가 시작되지 않은 경우

특성

설명

필요한 경우 각 인수가 자동으로 이스케이프됩니다.

중요합니다

신뢰할 수 없는 데이터로 이 메서드를 호출하는 것은 보안 위험입니다. 신뢰할 수 있는 데이터로만 이 메서드를 호출합니다. 자세한 내용은 모든 입력 유효성 검사참조하세요.

적용 대상