Vbscript to get detail information of any file
Dim filesys, demofile, createdate
Set filesys = CreateObject("Scripting.FileSystemObject")
Set demofile = filesys.GetFile("e:\TEST.xls")
createdate = demofile.DateCreated
WScript.Echo (createdate)
strHomeFolder = "E:\QTP"
Set objShell = CreateObject("Wscript.Shell")
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FolderExists (strHomeFolder) Then
' Assign user permission to home folder.
intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " & strHomeFolder & " /t /c /g Administrators:F ", 2, True)
WScript.Echo (intRunError)
If intRunError <> 0 Then
Wscript.Echo "Error assigning permissions for user " & strUser & " to home folder " & strHomeFolder
Else
Wscript.Echo "In inner loop"
End If
Else
Wscript.Echo "In Outer loop"
End If
WScript.Echo (demofile.Attributes)
'WScript.Echo (demofile.Type)
'WScript.Echo "Date created: " & demofile.DateCreated
'Wscript.Echo "Date last accessed: " & demofile.DateLastAccessed
'Wscript.Echo "Date last modified: " & demofile.DateLastModified
'Wscript.Echo "Drive: " & demofile.Drive
'Wscript.Echo "Name: " & demofile.Name
'Wscript.Echo "Parent folder: " & demofile.ParentFolder
'Wscript.Echo "Path: " & demofile.Path
'Wscript.Echo "Short name: " & demofile.ShortName
'Wscript.Echo "Short path: " & demofile.ShortPath
'Wscript.Echo "Size: " & demofile.Size
'Wscript.Echo "Type: " & demofile.Type
WScript.Quit
Set filesys = CreateObject("Scripting.FileSystemObject")
Set demofile = filesys.GetFile("e:\TEST.xls")
createdate = demofile.DateCreated
WScript.Echo (createdate)
strHomeFolder = "E:\QTP"
Set objShell = CreateObject("Wscript.Shell")
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FolderExists (strHomeFolder) Then
' Assign user permission to home folder.
intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " & strHomeFolder & " /t /c /g Administrators:F ", 2, True)
WScript.Echo (intRunError)
If intRunError <> 0 Then
Wscript.Echo "Error assigning permissions for user " & strUser & " to home folder " & strHomeFolder
Else
Wscript.Echo "In inner loop"
End If
Else
Wscript.Echo "In Outer loop"
End If
WScript.Echo (demofile.Attributes)
'WScript.Echo (demofile.Type)
'WScript.Echo "Date created: " & demofile.DateCreated
'Wscript.Echo "Date last accessed: " & demofile.DateLastAccessed
'Wscript.Echo "Date last modified: " & demofile.DateLastModified
'Wscript.Echo "Drive: " & demofile.Drive
'Wscript.Echo "Name: " & demofile.Name
'Wscript.Echo "Parent folder: " & demofile.ParentFolder
'Wscript.Echo "Path: " & demofile.Path
'Wscript.Echo "Short name: " & demofile.ShortName
'Wscript.Echo "Short path: " & demofile.ShortPath
'Wscript.Echo "Size: " & demofile.Size
'Wscript.Echo "Type: " & demofile.Type
WScript.Quit
No comments:
Post a Comment