Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Properties of .exe files

Status
Not open for further replies.

vvlad

Programmer
May 27, 2002
151
DE
Hi,

Is there a way to read the properties of an EXE file at run-time?

I want to build an exe and clone it, than based on its title or some other property decide at run-time what actions to performe.

Thanks

vlad
 
Look into DirectoryInfo and .GetFiles()

google will treat you well
 
Unfortunately I could not find the answer. And I also googled a lot before asking that question.

vlad
 
using System.IO;

Code:
string directory = Server.MapPath("Music/Dave");
	DirectoryInfo dirInfo = new DirectoryInfo(directory);
	FileInfo[] fileInfo = dirInfo.GetFiles("*.mp3");
	
	MusicBean[] beans  = new MusicBean[fileInfo.Length];
	
	
	
	for (int i = 0; i < fileInfo.Length; i++)
	{
		beans[i] = new MusicBean();
		beans[i].name = fileInfo[i].Name;
		beans[i].created = fileInfo[i].CreationTime.ToShortDateString();
		beans[i].fileSize = (fileInfo[i].Length / 1024).ToString("# ###") + "kb";
		beans[i].musicURL = @"Music/Dave/" + fileInfo[i].Name;
	}

This is what I do on one of my websites. It gets all the files in a directory and displays each file's properties.
 
Thanks for answering JunkMonkey, but I guess my question was not clear enough.

I am not interested in the name or size of the file, but in properties like title, author, comments, properties that one can set by right-clicking the file name and going to Properties->Summary.

vlad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top