总脚本,可能对你有帮助
#define MyAppName "showing the last modified date of selected file or directory"
#define MyAppVersion "1.5"
#define MyAppPublisher "My company"
#define MyAppURL "http://www.example.com/"
;#define MyAppExeName "MyProg.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{CD4CCA6A-5495-4132-98EE-44BC071E850B}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
CreateAppDir=no
DisableDirPage=yes
DisableProgramGroupPage=yes
OutputDir=C:\Users\Gangadhar\Desktop\showing last modified date
OutputBaseFilename=last modified date of any file
Compression=lzma
SolidCompression=yes
DisableFinishedPage=yes
[Messages]
buttoninstall=&Close Application
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Code]
const
GetFileExInfoStandard = $0;
type
FILETIME = record
LowDateTime: DWORD;
HighDateTime: DWORD;
end;
WIN32_FILE_ATTRIBUTE_DATA = record
FileAttributes: DWORD;
CreationTime: FILETIME;
LastAccessTime: FILETIME;
LastWriteTime: FILETIME;
FileSizeHigh: DWORD;
FileSizeLow: DWORD;
end;
SYSTEMTIME = record
Year: WORD;
Month: WORD;
DayOfWeek: WORD;
Day: WORD;
Hour: WORD;
Minute: WORD;
Second: WORD;
Milliseconds: WORD;
end;
var
FileInformation: WIN32_FILE_ATTRIBUTE_DATA;
FileName: String;
SystemInfo: SYSTEMTIME;
function GetFileAttributesEx (
FileName: string;
InfoLevelId: DWORD;
var FileInformation: WIN32_FILE_ATTRIBUTE_DATA
): Boolean;
external 'GetFileAttributesExA@kernel32.dll stdcall';
function FileTimeToSystemTime(
FileTime: FILETIME;
var SystemTime: SYSTEMTIME
): Boolean;
external 'FileTimeToSystemTime@kernel32.dll stdcall';
function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo,
MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
S: String;
Months,days:tarrayofstring;
i:integer;
begin
i:=0;
Months:=['January','February','March','April','May','June','July','August','September','October','November','December'];
Days:=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
S:=''; //Modified: 22 ?June ?2013, ??04:14:00 PM ?24 ?June ?2013, ??02:38:18 PM
S:=S+Newline;
S:=S+'Selected Filename :'+Newline+Filename+Newline+Newline;
S:=S+'Last modified date of Selected file is: ' ;
for i:=0 to 6 do
begin
if SystemInfo.DayOfWeek=i then
S:=S+Days[i]+', ';
end;
S:=S+inttostr(SystemInfo.Day)+'-';
//January February March April May June July August September October November December
for i:=0 to 11 do
begin
if SystemInfo.Month=i+1 then
S:=S+Months[i];
end;
S:=S+'-'+inttostr(SystemInfo.Year);
Result:=S;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
// allow users to go through the wizard by default
Result := True;
// if the user is going to leave the welcome page, then...
if CurPageID = wpWelcome then
begin
// set the initial file name
FileName := '';
// open the file dialog; if the user cancels it, they will stay at
// the welcome page (I don't know if it's your intention though)
Result := GetOpenFileName('Select the file to check', FileName, '',
'ALL Files (*.*)|*.*|All Files|*.*', '');
// if the user selected a file, then do whatever you want with it
if Result then
begin
GetFileAttributesEx(format('%s', [FileName]), GetFileExInfoStandard , FileInformation);
FileTimeToSystemTime(FileInformation.LastWriteTime, SystemInfo);
// MsgBox(format('LAST MODIFIED DATE OF SELECTED FILE IS : %2.d-%2.2d-%4.4d', [SystemInfo.Day, SystemInfo.Month, SystemInfo.Year]), mbInformation, MB_OK);
// you got the file name in FileName variable
end;
end;
end;