Microsoft指令碼執行時 3

2021-10-06 12:12:59 字數 2302 閱讀 3604

這是專門處理microsoft指令碼執行時庫的一系列技巧中的第3條。 在本技巧中,我們將向您展示如何返回與檔案有關的特定屬性,以及各種複製,移動和刪除它們的方法。 該**是不言自明的,因此我將直接跳入:

dim fso as filesystemobject, fil as file

'set fso = new scripting.filesystemobject    or

set fso = createobject("scripting.filesystemobject")

set fil = fso.getfile("c:\windows\system32\calc.exe")

debug.print "file created on: " & fil.datecreated

debug.print "file size: " & formatnumber(fil.size, 0) & " bytes"

debug.print "file drive: " & fil.drive

debug.print "file name: " & fil.name    'or

debug.print "file name: " & fso.getfilename(fil)

debug.print "file last modified: " & fil.datelastmodified

debug.print "file last accessed: " & fil.datelastaccessed

debug.print "file parent folder: " & fil.parentfolder

debug.print "file type: " & fil.type

debug.print "file path: " & fil.path

debug.print "file short name: " & fil.shortname

debug.print "file short path: " & fil.shortpath

debug.print "file extension: " & fso.getextensionname(fil)

debug.print "file version: " & fso.getfileversion(fil)

'to copy a file (copy c:\windows\system32\calc.exe ==> c:\dell\copy.exe)

fil.copy ("c:\dell\copy.exe")       'or

fso.copyfile "c:\windows\system32\calc.exe", "c:\dell\copy.exe", true

'to delete a file (c:\dell\ip.txt)

set fil = fso.getfile("c:\dell\ip.txt")

fil.delete true     'or

fso.deletefile "c:\dell\ip.txt", true

'to move a file (c:\dell\move_from.txt ==> c:\test\move_to.txt

set fil = fso.getfile("c:\dell\move_from.txt")

fil.move "c:\test\move_to.txt"      'or

fso.movefile "c:\dell\move_from.txt", "c:\test\move_to.txt"

檔案屬性輸出:
file created on: 9/11/2007 2:18:54 pm

file size: 114,688 bytes

file drive: c:

file name: calc.exe

file name: calc.exe

file last modified: 8/4/2004 5:00:00 am

file last accessed: 2/15/2008 11:30:31 am

file parent folder: c:\windows\system32

file path: c:\windows\system32\calc.exe

file short name: calc.exe

file short path: c:\windows\system32\calc.exe

file extension: exe

file version: 5.1.2600.0

from:

PHP指令碼執行時間

php設定指令碼最大執行時間的三種方法 php.ini 中預設的最長執行時間是 30 秒,這是由 php.ini 中的 max execution time 變數指定,如果指令碼需要跑很長時間,例如要大量傳送電子郵件,或者分析統計大量資料,伺服器會在 30 秒後強行中止正在執行的程式,這種情況就要更...

檢視指令碼執行時間命令

time process name real 0m1.937s user 0m0.007s sys 0m0.006s real 從程式開始到執行結束的時間,中間可能被別的程式中斷 時間片到,作業系統呼叫其它程式進行執行 io延遲等這些不是程式執行 的時間都會被算在real上面 user user m...

計算shell指令碼的執行時間

有時候可能需要計算 shell 指令碼 執行了多久,怎麼統計這個指令碼 執行多長時間呢?直接看 bin bash start time date date 0 days ago y m d h m s this is your shell script sleep 18 finish time da...