- Sub Dirs(strPath)
- strPath = chr(34) & strPath & chr(34)
- Dim objShell
- set objShell=WScript.CreateObject("wscript.shell")
- objShell.Run "%comspec% /c dir/s " & strPath & ">dir.txt" , 0, true
- Set objShell=NoThing
- End sub
复制代码 '
a.vbs :- Call Dirs("D:\My Documents")
复制代码 '
b.vbs :- Set objArgs = WScript.Arguments
- For i= 0 to objArgs.count-1
- ' msgbox objArgs(i)
- Call Dirs(objArgs(i))
- Next
- Set objArgs=Nothing
复制代码 ''
a.vbs 可產生 dir.txt
b.vbs 拖曳資料夾至此,則無反應? |