RobertAlanGustafsonII
Active member
- Joined
- Sep 16, 2023
- Messages
- 26
- Programming Experience
- 10+
WHAT I HAVE:
Visual Basic 2019, .NET Framework 4.6+, WinForms
MY ISSUE:
I would like my program to programmatically search for an exe file on my system drive and return its full path (so my program knows if and where it exists before trying to start the Process), but I've realized that the file is all but certain to be in a folder that one needs special permission to search (or a subfolder thereof)--i.e., "System", "Program Files", "Program Files (x86)"--complicating my efforts to use GetFiles/GetDirectories to look for it. Even trying do a single GetFiles method call on entire system drive with SearchOptions.AllDirectories causes an exception--and a targeted search within strategic folders (and their subfolders) causes many exceptions. Is there a (relatively) simple way for my app to programmatically obtain the necessary permissions for parent folders where program files are typically stored--or, better yet, a simple 1-step (or few-step) way to simply find the path of an arbitrary exe file? I want a VB.NET procedure that takes a String like ExeFile and returns a fully-qualified string for its entire path. Please give it to me ASAP in VB.NET, and as simply as possible.
Visual Basic 2019, .NET Framework 4.6+, WinForms
MY ISSUE:
I would like my program to programmatically search for an exe file on my system drive and return its full path (so my program knows if and where it exists before trying to start the Process), but I've realized that the file is all but certain to be in a folder that one needs special permission to search (or a subfolder thereof)--i.e., "System", "Program Files", "Program Files (x86)"--complicating my efforts to use GetFiles/GetDirectories to look for it. Even trying do a single GetFiles method call on entire system drive with SearchOptions.AllDirectories causes an exception--and a targeted search within strategic folders (and their subfolders) causes many exceptions. Is there a (relatively) simple way for my app to programmatically obtain the necessary permissions for parent folders where program files are typically stored--or, better yet, a simple 1-step (or few-step) way to simply find the path of an arbitrary exe file? I want a VB.NET procedure that takes a String like ExeFile and returns a fully-qualified string for its entire path. Please give it to me ASAP in VB.NET, and as simply as possible.