This documentation is archived and is not being maintained.

FileVersionInfo.FileName Property

Gets the name of the file that this instance of FileVersionInfo describes.

[Visual Basic]
Public ReadOnly Property FileName As String
[C#]
public string FileName {get;}
[C++]
public: __property String* get_FileName();
[JScript]
public function get FileName() : String;

Property Value

The name of the file described by this instance of FileVersionInfo.

Example

The following example calls GetVersionInfo to get the FileVersionInfo for the Notepad. Then it prints the FileName in a text box. This code assumes textBox1 has been instantiated.

[Visual Basic] 
Private Sub GetFileName()
    ' Get the file version for the notepad.
    Dim myFileVersionInfo As FileVersionInfo = _
        FileVersionInfo.GetVersionInfo("%systemroot%\Notepad.exe")
    
    ' Print the file name.
    textBox1.Text = "File name: " & myFileVersionInfo.FileName
End Sub 'GetFileName

[C#] 
private void GetFileName() {
    // Get the file version for the notepad.
    FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
 
    // Print the file name.
    textBox1.Text = "File name: " + myFileVersionInfo.FileName;
 }


[C++] 
private:
void GetFileName() {
    // Get the file version for the notepad.
    FileVersionInfo* myFileVersionInfo = FileVersionInfo::GetVersionInfo(S"%systemroot%\\Notepad.exe");
 
    // Print the file name.
    textBox1->Text = String::Format( S"File name: {0}", myFileVersionInfo->FileName );
 }


[JScript] 
private function GetFileName() {
    //Get the file version for the notepad.
    var myFileVersionInfo : FileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
 
    //Print the file name.
    textBox1.Text = "File name: " + myFileVersionInfo.FileName;
 }

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

FileVersionInfo Class | FileVersionInfo Members | System.Diagnostics Namespace

Show: