Hello,

I am looking for a way to check two different paths for the same file.

for example I have a script that looks for a file called pccnt.exe on
the entire computer and then runs the trend micro install program if
it does not find that file.

But I would like to speed this up since I already know that the file I
am looking for is always in C:\Program Files\Trend Micro\Officescan
client\ or in D:\Program Files\Trend Micro\Officescan client\.

I would like to know how to tell the script to check the C: path and
the D: path for this file and then run the install program if it does
not find it on either drive, however if it does find this file on D:
or on C: then to just quit.

Here is the script I am running now, and although it works great. It
seems to be slowing down log on time for some of my users.

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root
\cimv2")

Set colFiles = objWMIService.ExecQuery _
("Select * From CIM_Datafile Where FileName = 'pccnt' and
Extension = 'exe'")

Set objShell = CreateObject("Wscript.Shell")

If colFiles.Count > 0 Then
Wscript.Quit
Else
On Error Resume Next
objShell.Run "\\MYSERVERNAME\ofcscan\install_trend.cmd"
End If

Thanks for your input.

Re: Check two or more folders for the same file by 66Catalina

66Catalina
Wed Apr 04 17:43:19 CDT 2007

On Apr 4, 3:17 pm, Alexander Mueller <mille...@hotmail.com> wrote:
> 04.04.2007 21:58, 66Catal...@gmail.com schrieb:
>
> > I am looking for a way to check two different paths for the same file..
> > for example I have a script that looks for a file called pccnt.exe ..
> > But I would like to speed this up since I already know that the file I
> > am looking for is always in C:\Program Files\Trend Micro\Officescan
> > client\ or in D:\Program Files\Trend Micro\Officescan client\.
>
> if you're certain the file will only exist in none, one or both of these
> two locations, two calls of FSO.FileExists will perfectly satisfy your needs
>
> Const l1 = ":\Program Files\Trend Micro\Officescan client\pccnt.exe"
>
> Dim fs
> Dim found
>
> Set fs = CreateObject("Scripting.FileSystemObject")
>
> found = False
> If fs.FileExists("C" & l1) Then
> WSH.Echo "Found pccnt.exe in C" & l1
> found = True
> End If
> If fs.FileExists("D" & l1) Then
> WSH.Echo "Found pccnt.exe in D" & l1
> found = True
> End If
> If Not found Then
> WSH.Echo "Couldn't locate pccnt.exe"
> 'run installer
> End If
>
> MfG,
> Alex

Awesome, Thanks alot for your help.

But....now I have another problem.

Trend Micro installs to "D:\ProgramFiles" (not sure why I didn't
notice the lack of a space there?) or to "C:\Program Files", so is
there a way to add the second path without the space in Program Files
on D: to the script?

Thanks for your help