Jump to content
ur

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

Use:
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:

Use:
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.")
        Exit
    EndIf
    If @error = 4 Then
        MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.")
        Exit
    EndIf
    ; 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
        EndIf
    Next
    return "0"

EndFunc   ;==>Example

 

Share this post


Link to post
Share on other sites

EX: Flash Player 24.0.0.194.exe

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

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

Spoiler

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

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

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.

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

Au3Record.exe

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

    • By Pike
      Hey Everyone, I haven't been here in a while and recently picked up my old project. Still an FNG!
      To the point: I want to be able to push the button and either play an mp3, open a file, or open an exe program (all with the same button). The problem is that I don't know how to code for that at "case 1"
              Case 1                                                                                                                                             
                  Local $sRead = IniRead("config.ini", "Config", "One", "Default")                                
                  SoundPlay($sRead, @HotKeyPressed)                                                                     <-------------------------------
                  Run($sRead, @HotKeyPressed)                                                                                 <------------------------------- This 'Run' doesn't work even by itself!
      See code below for layout. If you need more information I will attach more code or answer any questions. Any help is greatly appreciated.
       
      Much Respect,
      Pike
       
      Func _HandleButton() $iClickCount += 1 $iTimer = TimerInit() AdlibRegister("CheckButtonPress", $CheckTime) EndFunc Func CheckButtonPress() If TimerDiff($iTimer) < $CheckTime Or $iTimer = 0 Then Return Switch $iClickCount Case 1 Local $sRead = IniRead("config.ini", "Config", "One", "Default") SoundPlay($sRead, @HotKeyPressed) Run($sRead, @HotKeyPressed) Case 2 MsgBox(0, "INFORMATION:", "Choose the file you want designated to this button") Local $sFileOpenDialog = FileOpenDialog(0, @ScriptDir & "\", "All (*.*)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If @error Then MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") EndIf Local $sFileName = InputBox("INFORMATION:", "Please Name Your File?" & @CRLF _ & @CRLF _ & "6 Characters or Less", "") IniWrite(@ScriptDir & "\config.ini", "Config", "One", $sFileOpenDialog) IniWrite(@ScriptDir & "\config.ini", "Config", "NameOne", $sFileName) EndSwitch $iClickCount = 0 AdlibUnRegister() EndFunc  

    • By Skeletor
      Hey All,
      Yes, this is an odd request. 
      But is there a way to bulk up the size of the compiled program? 
      I know many want to reduce it's size, but I want to increase it.
      What methods do you suggest?
    • By dimm
      Is it possible to compile script without any icon resources included?
      When I make exe it uses default system icon of current OS even if I compile as console application.
      On other versions of Windows it looks a little strange

       
      Update:
      It seems that the only way is remove icons from exe after compilation using resource editors like ResHacker.

       
      another bad solution:
      Using corrupted 35 bytes icon file. Windows can't load it and shows default system icon.
      #pragma compile(Icon, broken.ico) broken.ico
    • By Pricehacker
      Hello!
      I want to make a script that changes the filesize of program files while still having them run as usual.
      I tried FileWrite() but then the program wouldnt be recognized as a runnable program, could you guys help me to the right path?
    • By HariKara
      Hi AutoIters!
       
      Im trying to launch a .exe file that is nested within the program files (x86) folder structure. i have already used the standard RunAs Syntax and found that it fails to launch the application. I have switched to Run and that seems to work. My issue is I have to use RunAs as the applicaton would need to run under a completely different account. The Current logged in user is a Local User on the machine, however, the application must be run as a domain user. The Machine is domain connected.
       
       have tried the following:
      RunAs("username","logonpassword", $RUN_LOGON_PROFILE, "D:\Program Files (x86)\Vendor\Application Name\Exe Location\Executable.exe") The above fails to launch, there are no errors or syntax issues, it just does nothing when the variables are replaced for the correct values.
      I did the same using the Run command
      Run("D:\Program Files (x86)\Vendor\Application Name\Exe Location\Executable.exe") That seems to work fine, but runs in local user context. Any thoughts? Could it be a local Machine rights issue? Or have i missed something glaring in my script
×
×
  • Create New...