Jump to content

Need to find the path of exe

Recommended Posts


I have an exe with name "erwin Data Modeler r9.7 (32-bit)_2332.exe"


THe lat 4 digits 2332 may vary and also the version number r9.7 also might vary.

So, how to write a generic expression so that the exe can be picked from the current directory {with any version (9.7 or anything) and any build number (2332 or anything)}


Thanks in Advance

Share this post

Link to post
Share on other sites

StringInStr ( "string", "substring" [, casesense = 0 [, occurrence = 1 [, start = 1 [, count]]]] )

Kind Regards, Starf0x

Share this post

Link to post
Share on other sites
10 minutes ago, Starf0x said:

StringInStr ( "string", "substring" [, casesense = 0 [, occurrence = 1 [, start = 1 [, count]]]] )

Kind Regards, Starf0x

But this we can find only one substring right.But the 32 number is fixed above.

I forgot to mention above, if it is 64 instead of 32 then the exe should not be picked.

Share this post

Link to post
Share on other sites

Think about this, you said the last digits are different the rest is the same: " erwin Data Modeler"
So do a check to see if that piece of text exists, and then you have the filename.


Share this post

Link to post
Share on other sites

I need to check one more thins whether  32-bit  or 64-bit..Can you suggest.

Share this post

Link to post
Share on other sites

Got it, Thanks @Starf0x

Func GetFileList($dir)
    ; List all the files and folders in the desktop directory using the default parameters.
    Local $aFileList = _FileListToArray($dir, "*")
    If @error = 1 Then
        MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.")
    If @error = 4 Then
        MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.")
    ; Display the results returned by _FileListToArray.
    ;_ArrayDisplay($aFileList, "$aFileList")

    For $vElement In $aFileList
        if StringInStr($vElement, "erwin Data Modeler")>0 and StringInStr($vElement, "32-bit")>0 Then
            return $vElement
    return "0"

EndFunc   ;==>Example


Share this post

Link to post
Share on other sites

You're welcome.
Thanks for sharing so others also have a chance for an solution.

Cheers, Starf0x

Share this post

Link to post
Share on other sites

EX: Flash Player

Local $search = FileFindFirstFile("Flash Player*.exe")
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Local $file = FileFindNextFile($search)
    $Exe = @ScriptDir & '\' & $file
    ShellExecuteWait($Exe, '-install')
    MsgBox(64, 'FlashPlayer', 'Complete!')

This is what i use to install flash player, only the numbers after this change, so this works every time.

I guess for you you could use

FileFindFirstFile("erwin Data Modeler*.exe")

StringInStr($vElement, "32-bit")>0 Then


Edited by careca


Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples


Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • ergo
      By ergo
      CronToTime.au3 UDF converts a Unix Cron expression into a DateTime string.
      On Unix systems a Cron expression made of five fields separated by blanks/tabs followed by a shell command to execute.

      e.g. 15-30 2,3,4,5 29 1-12 0-6 reboot
      +------------- minute (0 - 59)
      ¦ +------------- hour (0 - 23)
      ¦ ¦ +------------- day of month (1 - 31)
      ¦ ¦ ¦ +------------- month (1 - 12)
      ¦ ¦ ¦ ¦ +------------- day of week (0 - 6) (Sunday to Saturday, 7 is also Sunday)
      ¦ ¦ ¦ ¦ ¦ +------------- some shell command
      ¦ ¦ ¦ ¦ ¦ ¦
      ¦ ¦ ¦ ¦ ¦ ¦
      * * * * * reboot
      (In this UDF the 6th field has no meaning and no influence on the result).
      For more information see https://en.wikipedia.org/wiki/Cron

      Finds the next event of the specified Cron expression, starting from current UTC/GMT.
      _pce_findNextTimeUTC($sCronExp [, $bForwardSearch = True [, $minutesOffset = 0]]])
      Finds the next event of the specified Cron expression. If $sDateTime is not set, local time will be used.
      _pce_findNextTime($sCronExp [, $bForwardSearch = True [, $sDateTime = "" [, $minutesOffset = 0]]])
      Convert names in usable Cron expression values. e.g. "15-30 2,3,4,5 29 July-December Mo-Su" to "15-30 2,3,4,5 29 7-12 1-7"
      _pce_convertNames( $sCronExp )
      See the include for details.
    • nacerbaaziz
      By nacerbaaziz
      Hello all
      I have a question please
      I have a link to an .exe file
      for example this link
      I want to check if the link is exists orno
      surely  Without downloading the file
      is there any  function or a way to  do this?
      Thanks in advance
    • Earthshine
      By Earthshine
      This baby can do almost any language! I found Gleany on this site and set it up on a fresh win10 install. all i would need to do to make it build an exe of the search files app we discovered is the .NET Target Framework download to build 100 % but the exe works and generates! You also need to add the path the the version of csc.exe that you want to run. MSBuild is part of .NET and can read your .csproj file.
      YOU can develop .NET OR C/C++ on this baby!
      Super lightweight (fit for crappy laptops), and you can use any dev compilers you wish, Ming, MS, etc, whatever.
      To use the build, you need to open the csproj file, else, to check your syntax it can compile individual files as well. The warning are because I do not have the .NET 4.6 Targeting Pack installed... LOL, and I could get rid of the Core warning, yes, I did not want to build a .NET Core.dll I wanted a live x64 exe! Told you MSBUILD could handle .CSPROJ, .VBPROJ, and all others Microsoft. Don't let Visual Code or Visual Studio slow you down, although, this works with Visual Code as well but there is only debugging in CORE.DLL projects

      ListFiles Example.zip

    • RC86
      By RC86
      Just a quick one as this has dawned on me recently when creating a little program.  When calling an executable I've created like Run(otherapp.exe) from within my executable is there a best practice to ensure things have gone smoothly?  So for example, should I monitor the PID to ensure it runs and closes within an acceptable timeframe?  Or within my other executable should I do EXITs in a certain way after functions and return codes etc?
      Could be a silly question but thought I'd ask.
    • Eggsplorer
      By Eggsplorer
      Ich hab ein Script für Windows Updates, dass nach dem OOBE aufgerufen werden soll. Run/RunOnce ist daher nicht möglich.
      Stattdessen möchte ich das Script in den Autostart schreiben lasse. Wenn die OOBE beendet wird und der Administrator angemeldet wird, soll das Update-Script einmalig aufgerufen werden und sich anschl. selbst löschen.
      Lang rede, kurzer Sinn:
      Wie kann ich folgendes Script in den Autostart schreiben?
      RunWait(@ComSpec & " /c " & "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File C:\UA\Scripts\win-updates.ps1 -MaxUpdatesPerCycle 100 -RestartRequired 1", "") Ich würde ungern eine BAT oder EXE reinkopieren, da ich es unsauber finde. Die müsste ja auch zusätzlich irgendwo liegen.