Process.Start 메서드

정의

프로세스 리소스를 시작한 후 Process 구성 요소에 연결합니다.

오버로드

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

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

Start(String, String, SecureString, String)

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

Start(String, String)

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

Start(String)

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

Start(ProcessStartInfo)

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

Start()

StartInfo 구성 요소의 Process 속성으로 지정된 프로세스 리소스를 시작하거나 다시 사용하여 구성 요소에 연결합니다.

Start(String, IEnumerable<String>)

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

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

중요

이 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입니다.

domain
String

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

반환

프로세스 리소스와 연결되거나 시작된 프로세스가 없는 경우 null에 연결되는 새 Process입니다. 같은 프로세스에서 이미 실행 중인 인스턴스와 함께 시작되는 새 프로세스는 서로 독립적인 관계입니다. 뿐만 아니라 시작 시 HasExited 속성이 이미 true로 설정되어 있는 null이 아닌 프로세스가 반환될 수 있습니다. 이 경우 시작된 프로세스가 자체의 기존 인스턴스를 활성화한 후 종료될 수 있습니다.

특성

예외

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

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

또는

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

또는

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

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

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

설명

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

참고

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

참고

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

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

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

참고

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

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

적용 대상

Start(String, String, SecureString, String)

중요

이 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입니다.

domain
String

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

반환

프로세스 리소스와 연결되거나 시작된 프로세스가 없는 경우 null에 연결되는 새 Process입니다. 같은 프로세스에서 이미 실행 중인 인스턴스와 함께 시작되는 새 프로세스는 서로 독립적인 관계입니다. 뿐만 아니라 시작 시 HasExited 속성이 이미 true로 설정되어 있는 null이 아닌 프로세스가 반환될 수 있습니다. 이 경우 시작된 프로세스가 자체의 기존 인스턴스를 활성화한 후 종료될 수 있습니다.

특성

예외

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

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

또는

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();
        }
    }
}
' 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 인스턴스를 만들고, 속성의 , , PasswordUserNameDomain 속성을 설정하고FileName, 인스턴스를 호출하는 Start 명시적 단계의 StartInfo 대안입니다Process.

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

참고

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

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

적용 대상

Start(String, String)

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

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

매개 변수

fileName
String

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

arguments
String

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

반환

프로세스 리소스와 연결되거나 시작된 프로세스가 없는 경우 null에 연결되는 새 Process입니다. 같은 프로세스에서 이미 실행 중인 인스턴스와 함께 시작되는 새 프로세스는 서로 독립적인 관계입니다. 뿐만 아니라 시작 시 HasExited 속성이 이미 true로 설정되어 있는 null이 아닌 프로세스가 반환될 수 있습니다. 이 경우 시작된 프로세스가 자체의 기존 인스턴스를 활성화한 후 종료될 수 있습니다.

특성

예외

fileName 또는 arguments 매개 변수가 null인 경우

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

또는

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

또는

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

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

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

예제

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

#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

설명

이 오버로드를 사용하여 파일 이름 및 명령줄 인수를 지정하여 프로세스 리소스를 시작합니다. 오버로드는 리소스를 새 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 구성 요소를 만들려는 경우 오버로드 중 하나를 사용합니다. 이 오버로드와 매개 변수가 없는 오버로드를 모두 사용하면 시작할 프로세스 리소스의 파일 이름과 전달할 명령줄 인수를 지정할 수 있습니다.

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

참고

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

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

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

추가 정보

적용 대상

Start(String)

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

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

매개 변수

fileName
String

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

반환

프로세스 리소스와 연결되거나 시작된 프로세스가 없는 경우 null에 연결되는 새 Process입니다. 같은 프로세스에서 이미 실행 중인 인스턴스와 함께 시작되는 새 프로세스는 서로 독립적인 관계입니다. 뿐만 아니라 시작 시 HasExited 속성이 이미 true로 설정되어 있는 null이 아닌 프로세스가 반환될 수 있습니다. 이 경우 시작된 프로세스가 자체의 기존 인스턴스를 활성화한 후 종료될 수 있습니다.

특성

예외

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

또는

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

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

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

예제

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

#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

설명

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

참고

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

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

설정 하 여 ClickOnce 애플리케이션을 시작할 수는 fileName 매개 변수는 원래 애플리케이션을 설치한 위치 (예를 들어, 웹 주소). 하드 드라이브에 설치 된 위치를 지정 하 여 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 구성 요소를 만들려는 경우 오버로드 중 하나를 사용합니다. 이 오버로드와 매개 변수가 없는 오버로드를 모두 사용하여 시작할 프로세스 리소스의 파일 이름을 지정할 수 있습니다.

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

참고

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

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

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

추가 정보

적용 대상

Start(ProcessStartInfo)

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

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

매개 변수

startInfo
ProcessStartInfo

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

반환

프로세스 리소스와 연결되거나 시작된 프로세스가 없는 경우 null에 연결되는 새 Process입니다. 같은 프로세스에서 이미 실행 중인 인스턴스와 함께 시작되는 새 프로세스는 서로 독립적인 관계입니다. 뿐만 아니라 시작 시 HasExited 속성이 이미 true로 설정되어 있는 null이 아닌 프로세스가 반환될 수 있습니다. 이 경우 시작된 프로세스가 자체의 기존 인스턴스를 활성화한 후 종료될 수 있습니다.

특성

예외

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

또는

startInfo 매개 변수의 UseShellExecute 속성이 trueRedirectStandardInput이고, RedirectStandardOutput 또는 RedirectStandardError 속성 또한 true입니다.

또는

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

startInfo 매개 변수가 null인 경우

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

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

또는

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

또는

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

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

예제

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

이 메서드의 다른 용도에 대한 추가 예제는 클래스의 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 개체와 연결합니다.

참고

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

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

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

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

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

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

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

참고

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

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

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

추가 정보

적용 대상

Start()

StartInfo 구성 요소의 Process 속성으로 지정된 프로세스 리소스를 시작하거나 다시 사용하여 구성 요소에 연결합니다.

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

반환

프로세스 리소스가 시작된 경우에는 true이고 기존 프로세스를 다시 사용한 경우처럼 새 프로세스 리소스가 시작되지 않은 경우에는 false입니다.

특성

예외

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

또는

UseShellExecute , StartInfo 또는 trueRedirectStandardInput인 동안 RedirectStandardOutput속성의 RedirectStandardError 멤버는 true입니다.

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

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

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

예제

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

#using <System.dll>
using namespace System;
using namespace System::Diagnostics;
using namespace System::ComponentModel;

int main()
{
    Process^ myProcess = gcnew Process;

    try
    {
        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 );
    }
}
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);
            }
        }
    }
}
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 지정할 수 있습니다.

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

참고

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

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

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

추가 정보

적용 대상

Start(String, IEnumerable<String>)

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

public:
 static System::Diagnostics::Process ^ Start(System::String ^ fileName, System::Collections::Generic::IEnumerable<System::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.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
public static System.Diagnostics.Process Start (string fileName, System.Collections.Generic.IEnumerable<string> arguments);
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
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
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>

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

반환

프로세스 리소스와 연결되거나 시작된 프로세스가 없는 경우 null에 연결되는 새 Process입니다.

특성

설명

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

적용 대상