[轉貼]shell.Application列目錄及文件屬性
SUB GetFolder(FolderName)
Const She = "Shell"
Const APP = "Application"
dim FileContent,FileNameString
set sl=createobject(CreateProgID(She,APP))
XA = FolderName
if (XA <> "") then
set fod1=sl.namespace(XA)
set foditems=fod1.items
for each co in foditems
If co.isfolder Then wscript.echo co.path & VBCRLF
next
End If
End Sub
Function CreateProgID(Var1,Var2)
CreateProgID = Var1 & "." & Var2
End Function
GetFolder("C:\")
GetFiler("c:\Release\")
SUB GetFiler(FolderName)
Const She = "Shell"
Const APP = "Application"
set sl=createobject(CreateProgID(She,APP))
XA = FolderName
if (XA <> "") then
set fod1=sl.namespace(XA)
set foditems=fod1.items
for each co in foditems
If Not co.isfolder Then wscript.echo Replace(Replace(Right(co.path,Len(co.path) - Len(XA)),"\",""),"/","")& "----" & co.size &"--------"&co.type&"-------"&co.ModifyDate&"------"&fod1.GetDetailsOf(co, 6)&VBCRLF
Next
End If
End Sub
Dim arrHeaders(34)
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("c:\Release\")
For i = 0 to 33
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
Next
For Each strFileName in objFolder.Items
For i = 0 to 33
Wscript.echo i & vbtab & arrHeaders(i) & ": " & objFolder.GetDetailsOf(strFileName, i)
Next
Next
Set app= CreateObject("Shell.Application")
app.ShellExecute "cmd.exe","cmd /c ping www.haiyangtop.net","c:\","",1
set app=Nothing
'0 hide
'1 show
'2 min
'3 max
不用說了,第一個參數是「程序名」,第二個參數是「程序參數」,第三個參數是「路徑」,第四個參數「未知」,第五個參數如下表:
0 隱藏運行
1 正常運行
2 最小化運行
3 最大化運行
Const She = "Shell"
Const APP = "Application"
dim FileContent,FileNameString
set sl=createobject(CreateProgID(She,APP))
XA = FolderName
if (XA <> "") then
set fod1=sl.namespace(XA)
set foditems=fod1.items
for each co in foditems
If co.isfolder Then wscript.echo co.path & VBCRLF
next
End If
End Sub
Function CreateProgID(Var1,Var2)
CreateProgID = Var1 & "." & Var2
End Function
GetFolder("C:\")
GetFiler("c:\Release\")
SUB GetFiler(FolderName)
Const She = "Shell"
Const APP = "Application"
set sl=createobject(CreateProgID(She,APP))
XA = FolderName
if (XA <> "") then
set fod1=sl.namespace(XA)
set foditems=fod1.items
for each co in foditems
If Not co.isfolder Then wscript.echo Replace(Replace(Right(co.path,Len(co.path) - Len(XA)),"\",""),"/","")& "----" & co.size &"--------"&co.type&"-------"&co.ModifyDate&"------"&fod1.GetDetailsOf(co, 6)&VBCRLF
Next
End If
End Sub
Dim arrHeaders(34)
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("c:\Release\")
For i = 0 to 33
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
Next
For Each strFileName in objFolder.Items
For i = 0 to 33
Wscript.echo i & vbtab & arrHeaders(i) & ": " & objFolder.GetDetailsOf(strFileName, i)
Next
Next
Set app= CreateObject("Shell.Application")
app.ShellExecute "cmd.exe","cmd /c ping www.haiyangtop.net","c:\","",1
set app=Nothing
'0 hide
'1 show
'2 min
'3 max
不用說了,第一個參數是「程序名」,第二個參數是「程序參數」,第三個參數是「路徑」,第四個參數「未知」,第五個參數如下表:
0 隱藏運行
1 正常運行
2 最小化運行
3 最大化運行
沒有留言:
張貼留言