I need a .vbs to search subfolders of %programfiles%\adobe and find acrobat.exe (eg. %programfiles%\Adobe\Acrobat 9.0\Acrobat) then return and filter the results to the Acrobat version folder (eg. Acrobat 9.0).
I have an old batch which does this but I’m not sure on the VB side :
@ECHO OFF
PUSHD “%programfiles%\java”
FOR /f “tokens=1-4 delims=\” %%a IN (‘DIR /b /s “javaw.exe”‘) DO ECHO %%a\%%b\%%c\%%d
POPD
PAUSE
This is what I have so far to search %programfiles%\Java and return all files in subdirectories:
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
objStartFolder = “%programfiles%\Java”
Set objFolder = objFSO.GetFolder(objStartFolder)
Wscript.Echo objFolder.Path
Set colFiles = objFolder.Files
For Each objFile in colFiles
Wscript.Echo objFile.Name
Next
Wscript.Echo
ShowSubfolders objFSO.GetFolder(objStartFolder)
Sub ShowSubFolders(Folder)
For Each Subfolder in Folder.SubFolders
Wscript.Echo Subfolder.Path
Set objFolder = objFSO.GetFolder(Subfolder.Path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
Wscript.Echo objFile.Name
Next
Wscript.Echo
ShowSubFolders Subfolder
Next
End Sub
Fair enough. There should be a better way, presumably by querying the registry, but I don’t have Acrobat installed, so I can’t go hunting by myself.
How To Ask Questions The Smart Way