다음을 통해 공유


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;
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 에 따라 부분적으로 달라집니다. 이 true경우 UseShellExecute 문서를 시작하고 구성 요소를 사용하여 인쇄 Process 와 같은 파일에 대한 작업을 수행할 수 있습니다. 이 경우 UseShellExecutefalse구성 요소를 사용하여 Process 실행 파일만 시작할 수 있습니다.

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

중요합니다

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

적용 대상