l3ill Posted January 18, 2014 Posted January 18, 2014 Hi, Trying to to find a way to get the full path to a programs executable with that program not running. I have searched the Help File and forums and have not been able to find a way that works the same every time. This works but only on some programs: >_GetInstalledPath ( I got this to find the full path to Irfan View's exe by only using "iview", "Irfan" as the criteria, strangely enough it only worked on that one program. ) >This works too but only if you know the exact name of the exe. And in this same thread >this was mentioned which leads me to believe that there is an easier more foolproof way. With all the WinApi Path modules, I cant believe there isn't one that does this... Thanks in advance for any pointers. Bill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
mikell Posted January 18, 2014 Posted January 18, 2014 You can arrange the code from your 2nd link This one returns the path for all the exe which name includes the word 'autoit' #include <Constants.au3> $sDriveToSearch = "C:\" $sAppToFind = "autoit" Local $foo = Run(@ComSpec & ' /c dir "' & $sDriveToSearch & '"' & '*.exe /s/b', "", @SW_HIDE, $STDOUT_CHILD) Local $line, $path While 1 $line = StdoutRead($foo) If @error Then ExitLoop If StringInStr(StringRegExpReplace($line, '.+\\(.+)', "$1"), $sAppToFind) Then $path &= StringStripWS($line, 3) & @CRLF WEnd Msgbox(0,"", $path) ;ConsoleWrite($path & @CRLF)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now