D
dfs
Unregistered / Unconfirmed
GUEST, unregistred user!
程序如下:<br>program setfiletime;<br><br>{$APPTYPE CONSOLE}<br><br>uses<br> SysUtils,WINDOWS;<br>var<br>pa1,pa2,pa3 : string; //pa1:参数1 文件名;pa2:参数2 时间<br>i: Integer;<br>x,y,z:TFiletime;//变<br>function DateTimeToFileTime(DateTime:TDateTime):TFileTime;<br>var<br> SystemTime:TSystemTime;<br>begin<br> with SystemTime do<br> begin<br> DecodeDate(DateTime, wYear, wMonth, wDay);<br> DecodeTime(DateTime, wHour, wMinute, wSecond, wMilliSeconds);<br> end;<br> SystemTimeToFileTime(SystemTime,Result);<br>end;<br>begin<br><br><br> { TODO -oUser -cConsole Main : Insert code here }<br> pa1:=ParamStr(1);<br> pa2:=ParamStr(2);<br> writeln(pa1);<br> writeln(pa2);<br> //<br> i:= fileopen(pa1,fmOpenReadWrite);<br> x:=DateTimeToFileTime(strtodate(pa2));<br> y:=DateTimeToFileTime(strtodate(pa2));<br> z:=DateTimeToFileTime(strtodate(pa2));<br> SetFileTime(i,@x,@y,@z);<br> fileclose(i);<br><br> //<br><br> writeln('Press any key to continue...') ;<br> readln;<br>end.<br>