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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VBS script to find files

Reply to Message Icon

Name: djfox1
Date: October 26, 2006 at 07:41:20 Pacific
OS: XP
CPU/Ram: NA
Product: 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



Sponsored Link
Ads by Google

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

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


0
Reply to Message Icon

Related Posts

See More







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


Sponsored links

Ads by Google


Results for: VBS script to find files

Need bat script to check file size www.computing.net/answers/windows-xp/need-bat-script-to-check-file-size/142283.html

batch file to find files in folder www.computing.net/answers/windows-xp/batch-file-to-find-files-in-folder/175316.html

MY PICTURES TURNED TO VB SCRIPT FILES!! www.computing.net/answers/windows-xp/my-pictures-turned-to-vb-script-files/9719.html