{"id":11272,"date":"2021-12-08T01:36:22","date_gmt":"2021-12-08T01:36:22","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=11272"},"modified":"2021-12-08T01:36:44","modified_gmt":"2021-12-08T01:36:44","slug":"solved-vbscript-to-find-file-and-return-filtered-folder-path","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/vbscript-to-find-file-and-return-filtered-folder-path\/28076.html","title":{"rendered":"[Solved] VBScript To Find File And Return Filtered Folder Path"},"content":{"rendered":"<p>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).<\/p>\n<p>I have an old batch which does this but I&#8217;m not sure on the VB side :<br \/>\n@ECHO OFF<\/p>\n<p>PUSHD &#8220;%programfiles%\\java&#8221;<br \/>\nFOR \/f &#8220;tokens=1-4 delims=\\&#8221; %%a IN (&#8216;DIR \/b \/s &#8220;javaw.exe&#8221;&#8216;) DO ECHO %%a\\%%b\\%%c\\%%d<br \/>\nPOPD<br \/>\nPAUSE<\/p>\n<p>This is what I have so far to search %programfiles%\\Java and return all files in subdirectories:<br \/>\nSet objFSO = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)<br \/>\nobjStartFolder = &#8220;%programfiles%\\Java&#8221;<\/p>\n<p>Set objFolder = objFSO.GetFolder(objStartFolder)<br \/>\nWscript.Echo objFolder.Path<br \/>\nSet colFiles = objFolder.Files<br \/>\nFor Each objFile in colFiles<br \/>\nWscript.Echo objFile.Name<br \/>\nNext<br \/>\nWscript.Echo<\/p>\n<p>ShowSubfolders objFSO.GetFolder(objStartFolder)<\/p>\n<p>Sub ShowSubFolders(Folder)<br \/>\nFor Each Subfolder in Folder.SubFolders<br \/>\nWscript.Echo Subfolder.Path<br \/>\nSet objFolder = objFSO.GetFolder(Subfolder.Path)<br \/>\nSet colFiles = objFolder.Files<br \/>\nFor Each objFile in colFiles<br \/>\nWscript.Echo objFile.Name<br \/>\nNext<br \/>\nWscript.Echo<br \/>\nShowSubFolders Subfolder<br \/>\nNext<br \/>\nEnd Sub<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":5},"question-category":[55],"question_tags":[],"class_list":["post-11272","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/11272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=11272"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=11272"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=11272"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=11272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}