advcom
asked on
Need to get full path of a file that is part of the system path using vbscript of vb6
I am enumerating files from the registry for virus detection. Most files have a full path, but some are just a file name only. I realize that when they are file names only, they have to be within the system path as defined by the "path" variable. One of the things I need to do is check if the file exists. This is hard to do when you do not know where the file is exactly. I originally had it check in c:\windows and c:\windows\system32, but they could also be in c:\windows\sysWow64 or c:\windows\system32\driver s or any number of sub directories. So I soon realized that I needed a better solution. So the question is, if the registry value says soundman.exe, how do I determine what the full path is to that file. This can be in vbscript or VB6.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry, should a checked before posting. Mine only returns the first file.does not check for trailing "\" in the path.
Just to note also, you could use the built-in WHERE command of windows, either from a BAT file, or from VBSCRIPT. To get a sense for it's output just do something like:
WHERE XCOPY.EXE
at a command line.
~bp
WHERE XCOPY.EXE
at a command line.
~bp
ASKER
Trying out the scripts, thanks
bp, not familiar with the "where" command, tried it on xp pro, but no luck. Which Windows version is this command for?
bp, not familiar with the "where" command, tried it on xp pro, but no luck. Which Windows version is this command for?
I think WHERE may have been introduced in Vista. I know it exists in Win7. Wasn't sure what your platform was.
~bp
~bp
Since a VB or VBS solution was asked for, seems like the first post in the thread is the first viable solution.
~bp
~bp
ASKER
Worked great
Regards,
Rob.
Open in new window