VBS GetFiles Function als Array ausgeben

Seite 1 von 1 - Forum: Coding Stuff auf overclockers.at

URL: https://www.overclockers.at/coding-stuff/vbs_getfiles_function_als_array_ausgeben_136974/page_1 - zur Vollversion wechseln!


evrmnd schrieb am 16.02.2005 um 13:10

Hi,

Wie der Titel schon sagt will ich das als Array ausgeben.

So hab ichs jetzt

'------------------
' Function Get Files
'------------------
Dim l
Function GetFiles(ppath)

Set wsh = Wscript.CreateObject("Wscript.Shell")
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
Set fo = fso.GetFolder( wsh.ExpandEnvironmentStrings(ppath) )

Set fc = fo.Files
For Each l in fc
Wscript.echo l
Next

End Function
'------------------

allerdings schreibt er es dann nur als text raus... is ja klar...
ich hätte aber gerne das ich dann alle files in eine array eingetragen sind..

Kennt jemand die lösung?
Danke!
lg


mat schrieb am 16.02.2005 um 16:18

Code:
Function GetFiles(ppath)
Dim l,a,i

Set wshell = WScript.CreateObject("WScript.Shell")

Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
Set fo = fso.GetFolder(wshell.ExpandEnvironmentStrings(ppath))

Set fc = fo.Files

ReDim a(fc.Count)

i = 1
For Each l in fc
 a(i) = l

 i = i+1
Next

GetFiles = a
End Function

aTest = GetFiles("C:\")
WScript.echo aTest(8)


evrmnd schrieb am 16.02.2005 um 18:09

Wieder mal danke mat :)
Hast du vielleicht ne gute vbs page?

Danke!
lg


mat schrieb am 17.02.2005 um 01:53

http://msdn.microsoft.com oder google. spezielle tutorial pages udg kenne ich keine.




overclockers.at v4.thecommunity
© all rights reserved by overclockers.at 2000-2025