ProcessStartInfo.FileName 속성

정의

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

public:
 property System::String ^ FileName { System::String ^ get(); void set(System::String ^ value); };
public string FileName { get; set; }
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string FileName { get; set; }
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string FileName { get; set; }
[System.ComponentModel.SettingsBindable(true)]
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string FileName { get; set; }
[System.ComponentModel.SettingsBindable(true)]
public string FileName { get; set; }
member this.FileName : string with get, set
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.FileName : string with get, set
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.FileName : string with get, set
[<System.ComponentModel.SettingsBindable(true)>]
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.FileName : string with get, set
[<System.ComponentModel.SettingsBindable(true)>]
member this.FileName : string with get, set
Public Property FileName As String

속성 값

애플리케이션과 연결되며 그 애플리케이션에서 사용할 수 있는 기본 열기 동작이 있는 파일 형식의 문서 이름 또는 시작할 애플리케이션의 이름입니다. 기본값은 빈 문자열("")입니다.

특성

예제

#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

설명

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

사용할 수 있는 파일 형식 집합은 속성 값 UseShellExecute 에 따라 부분적으로 달라집니다. 이 이trueUseShellExecute 문서를 시작하고 구성 요소를 사용하여 인쇄 Process 와 같은 파일에 대한 작업을 수행할 수 있습니다. 가 인 false경우 UseShellExecute 구성 요소를 사용하여 Process 실행 파일만 시작할 수 있습니다.

설정 하 여 ClickOnce 애플리케이션을 시작할 수는 FileName 속성을 원래 애플리케이션 설치 위치 (예를 들어, 웹 주소). 하드 디스크에 설치 된 위치를 지정 하 여 ClickOnce 애플리케이션을 시작 하지 않습니다.

중요

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

적용 대상