URL: https://www.overclockers.at/coding-stuff/vbs_getfiles_function_als_array_ausgeben_136974/page_1 - zur Vollversion wechseln!
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
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)
Wieder mal danke mat
Hast du vielleicht ne gute vbs page?
Danke!
lg
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