COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button
ADVANCE VB SCRIPT FILE
File
File is an Object, which contains both properties and methods
that allow the developers to create, delete or move a file.
Methods
• Copy
• Delete
• Move
• openasTextStream
Properties
• Attributes
• DateCreated
• DateLastAccessed
• DateLastModified
• Drive
• Name
• ParentFolder
• Path
• ShortName
• ShortPath
• Size
• Type
Example
<!DOCTYPE html>
<html>
<body>
<script language="vbscript" type="text/vbscript">
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile("C:\user.js")
document.write "Line 1: "& f.DateCreated & "<br />"
document.write "Line 2: "& f.Attributes & "<br />"
document.write "Line 3: "& f.DateLastAccessed & "<br />"
document.write "Line 4: "& f.DateLastModified & "<br />"
document.write "Line 5: "& f.Drive & "<br />"
document.write "Line 6: "& f.Name & "<br />"
document.write "Line 7: "& f.ParentFolder & "<br />"
document.write "Line 8: "& f.Path & "<br />"
document.write "Line 9: "& f.ShortName & "<br />"
document.write "Line 10: "& f.ShortPath & "<br />"
document.write "Line 11: "& f.Size & "<br />"
document.write "Line 12: "& f.Type & "<br />"
f.copy ("D:\") & "<br />" 'copying to file to another location'
f.Move ("E:\") & "<br />" 'Move the file to another location'
f.Delete ("D:\") & "<br />" 'Delete to file from one location'
</script>
</body>
</html>
If the above script is saved as HTML and executed in IE,
we would get the following output in the console.
Line 1: 08/02/13 06:57:34
Line 2: 32
Line 3: 08/02/13 06:57:34
Line 4: 04/18/12 22:23:37
Line 5: C:
Line 6: user.js
Line 7: C:\
Line 8: C:\user.js
Line 9: user.js
Line 10: C:\user.js
Line 11: 474
Line 12: JScript Script File
No comments:
Post a Comment