tags:

views:

20

answers:

2

I'm looping in a folder to get all files inside it

Scripting.FileSystemObject doesn't seem to see that a file named ..lnk exist

is there a way to fix that?

thanks

A: 

Looping through a folder using WMI also seems to find *.lnk files. Try this example:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService. _
    ExecQuery("Select * from CIM_DataFile where Drive = 'C:' And Path = '\\Temp\\'")
For Each objFile in colFiles
    Wscript.Echo objFile.Name 
Next

I hope this helps.

/ Frank

fmunkert
A: 

it seem that I made a mistake while creating my test environment, I created a folder instead of a file.

now it's working.

Fredou