คำสั่ง:ลบไฟล์
รูปแบบ:
---------------------------------------------------
ตัวอย่าง:สั่งสร้างไฟล์ชื่อ newfile.txt ขึ้นวางไว้บนหน้าจอ จากนั้นอีก5วินาที ไฟล์นี้จะถูกลบทิ้งไป
รูปแบบ:
Code:
object.DeleteFile ( filespec[, force] )
ตัวอย่าง:สั่งสร้างไฟล์ชื่อ newfile.txt ขึ้นวางไว้บนหน้าจอ จากนั้นอีก5วินาที ไฟล์นี้จะถูกลบทิ้งไป
Code:
Dim FsoObj
Set FsoObj=CreateObject("Scripting.FileSystemObject")
FsoObj.CreateTextFile ("C:\Documents and Settings\Administrator\Desktop\newfile.txt")
WScript.Sleep 5000
FsoObj.DeleteFile ("C:\Documents and Settings\Administrator\Desktop\newfile.txt")
Set FsoObj=Nothing
Comment