Computing.Net > Forums > Windows XP > VBS script to find files

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

VBS script to find files

Reply to Message Icon

Original Message
Name: djfox1
Date: October 26, 2006 at 07:41:20 Pacific
Subject: VBS script to find files
OS: XP
CPU/Ram: NA
Model/Manufacturer: NA
Comment:

I posted this over at the programming section with no luck, so I thought I'd try here - can any script gurus tell me why my VBS script doesn't work? It's supposed to find and echo out any .doc files created after a date specified - when I run it, a command window opens and I see a blinking cursor and thats it.
----
strDate = "20061001000000.000000+000"
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("Select * From CIM_DataFile Where CreationDate > '" & strDate & "'")
For Each objFile in colFiles
Wscript.Echo objFile.Name
Next
---

Any help is appreciated.

Thanks,
Dave


Report Offensive Message For Removal


Response Number 1
Name: djfox1
Date: October 26, 2006 at 07:45:32 Pacific
Reply: (edit)

Oops - I posted the wrong script in the first message - this is the script I'm trying to get to work:
---
strDate = "20061001000000.000000+000"

strComputer = "."
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("Select * From CIM_DataFile Where CreationDate > '" & strDate & "'" & _
" AND Extension = 'doc'")
For Each objFile in colFiles
Wscript.Echo objFile.Name
Next
---

Again, it is supposed to find .doc files created on or after the date specified in the script, and echo them out. All I get is a command window and a blinking cursor.

Thanks,
Dave


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home








Do you own an iPhone?

Yes
No, but soon
No


View Results

Poll Finishes In 7 Days.
Discuss in The Lounge
Poll History




Data Recovery Software