我试图创建一个vbscript,列出dir中的所有内容并读取每个文件,提取数据来操作并使用这些数据作为参数运行powershell脚本。我发现以下内容开始,但它不起作用。有人可以帮忙吗?
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
答案 0 :(得分:0)
VBScript与VB非常相似,但是自从我上次使用VB以来已经很长时间了......
AFAIR ListBox1.Items.Add()期望和Item或字符串作为参数,而不是FileInfo对象 尝试使用 ListBox1.Items.Add(FileInfo.FullName)