//获取应程序文件的路径ExtractFilePath(Application.ExeName);
var oldName, newName : string; begin // Try to rename the current Unit1.dcu to Uni1.old oldName := 'Unit1.dcu'; newName := ChangeFileExt(oldName, '.new'); // Show the old and new values ShowMessage('Old name = '+oldName); ShowMessage('New name = '+newName); end; Old name = Unit1.dcu New name = Unit1.new var selectedFile : string; drive : char; path, fileName : string; begin // Ask the user to select a file if PromptForFileName(selectedFile) then begin // Display this full file/path value ShowMessage('Selected file = '+selectedFile); // Split this full file/path value into its constituent parts ProcessPath(selectedFile, drive, path, fileName); ShowMessage('drive = '+drive); ShowMessage('path = '+path); ShowMessage('fileName = '+fileName); end; end; { The user selects C:\Files\data.txt and hits OK } Selected file = C:\Files\data.txt drive = C path = \Files filename = data.txthttp://www.delphibasics.co.uk/index.html
转载于:https://www.cnblogs.com/shangdawei/archive/2013/04/29/3050238.html
相关资源:数据结构—成绩单生成器