Sign in to follow this  
Followers 0
supadodger

create an array of all exe in a directory and then run them?

8 posts in this topic

trying to create an array out of all executables in a sub-directory and then execute them all 1 at a time with a runwait.

just send me in the right direction or any help anyone can offer is appreciated.

Share this post


Link to post
Share on other sites



trying to create an array out of all executables in a sub-directory and then execute them all 1 at a time with a runwait.

just send me in the right direction or any help anyone can offer is appreciated.

Try looking up FileFindFirstFile and FileFindNextFile in the help file.

Share this post


Link to post
Share on other sites

Try looking up FileFindFirstFile and FileFindNextFile in the help file.

the problem i have is really making arrays.

anytime i try i end up doing

While $z < 20

$z = 1 + 1

if $z = 1 then

runwait blah.exe

Endif

and so on down the list.

:D

Share this post


Link to post
Share on other sites

here this example code puts every exe file in the subdirectory "subdirectory" into an array

#include <array.au3>
Dim $aFiles[101];I dont thnik you'll be needing mroe than 100 exes'?
$aFiles[0] = 0
$hFileSearch = FileFindFirstFile("subdirectory\*.exe")
while 1
    $sFileToAdd = FileFindNextFile($hFileSearch)
    If @error = 1 Then
        ExitLoop
    EndIf
    $aFiles[0]+=1
    $aFiles[$aFiles[0]] = $sFileToAdd
WEnd
_ArrayDisplay($aFiles)

Share this post


Link to post
Share on other sites

Maybe...

#Include <File.au3>

Global $Location = @DesktopDir

$FileList=_FileListToArray($Location, "*.exe", 1)
If @Error=1 Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf


For $x = 1 To UBound($FileList) -1
    $Runner = FileGetShortName($Location & "\" & $FileList[$x])
    
    ; Testing
    ConsoleWrite($Runner & @CRLF)
    Sleep(1000) 
    
    ; Do it!!
    ;RunWait($Runner)
Next

**********8 TESTED OK

Valuater

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

You know that could be used for a bug, sorry to say.

I would take them but for sure have another one with which youve already tested and know if they are good, because many hacks might be on anyones system. Also I wouldn't create a array and at the same time Runwait with it, what would be the sense of creating the array then? Runwait or better yet just Run would work with a little catch to it depending of the systems speed only run a few exe at any one time, most important of the is it should be outside the creating the array, maybe like Valuater did and one step further would be create a temporary file for it. Why you ask, because this thing wouldn't be about speed but ensuring the exe are run.


0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites

I remember doing something very similar to this for running cleaners. I wanted to run spyware, then adware, then internet cleaner, then.... and lastly the defrager

I did it something like this...

#Include <File.au3>

Global $Location = @DesktopDir

$FileList=_FileListToArray($Location, "*.exe", 1)
If @Error=1 Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf

$Argument = StringSplit(" -w, /n, etc..", ",")


For $x = 1 To UBound($FileList) -1
    $Runner = FileGetShortName($Location & "\" & $FileList[$x])
   
    ; Testing
    ConsoleWrite($Runner & @CRLF)
    Sleep(1000)
   
    ; Do it!!
    ;RunWait($Runner & $Argument)
Next

(just an example so you can get the idea)

8)


NEWHeader1.png

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
Sign in to follow this  
Followers 0