im trying to make a vbscript that would list all contents in dir and read through each file extracting the data to manipulate and run a powershell script using this data as arguments. i found the following to start off with but it does not work. can somebody help?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' make a reference to a directory
Dim di As New IO.DirectoryInfo("c:\")
Dim diar1 As IO.FileInfo() = di.GetFiles()
Dim dra As IO.FileInfo
'list the names of all files in the specified directory
For Each dra In diar1
ListBox1.Items.Add(dra)
Next
End Sub
VBScript was very similar to VB, but it was a long time since I used VB last time…
AFAIR ListBox1.Items.Add() expects and Item or a string as a parameter, NOT a FileInfo object
Try to use
ListBox1.Items.Add(FileInfo.FullName)