biglebowski
Technical User
Is there a way of changing this script so that it will output the name of each file to a text or csv file?
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFileList = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='C:\Scripts'} Where " _
& "ResultClass = CIM_DataFile")
For Each objFile In colFileList
Wscript.Echo objFile.Name
Next
I know nothing about scripting and found this on the MS scripting site.
Thanks
When I was born I was so suprised I didn't talk for 18 months
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFileList = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='C:\Scripts'} Where " _
& "ResultClass = CIM_DataFile")
For Each objFile In colFileList
Wscript.Echo objFile.Name
Next
I know nothing about scripting and found this on the MS scripting site.
Thanks
When I was born I was so suprised I didn't talk for 18 months