?
Solved

Find File Directory

Posted on 2013-05-15
2
Medium Priority
?
297 Views
Last Modified: 2013-05-15
I would like a VB.Net or even VBA script that looks on the C:\ drive for an executeable and then sets a string variable to that path.

It would search only C:\Program Files\ or C:\Program Files (x86)\ folders

Once file is found it stops

myExecuteablePath = "foundFullPath"
0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 39169432
dim strExe as string, strPath as string

strPath="C:\Program Files\"
strExe=dir(strPath & "*.exe")

while strExe <>""

      msgbox "The executable is " & strpath & strExe

      strExe=dir()
wend


strPath="C:\Program Files (x86)\"

strExe=dir(strPath & "*.exe")

while strExe <>""

      msgbox "The executable is " & strpath & strExe

      strExe=dir()
wend
0
 

Author Closing Comment

by:lrbrister
ID: 39169488
capricorn1

I mistated my question, which you answered correctly and efficiently.

I'm awarding points.
Please watch for new question
0

Featured Post

Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question