Jump to content
Sign in to follow this  
neo van matix

Get Filename ?

Recommended Posts


i'd like to write a little Script, which updates my Virus-Definitions.

On a local Server a Program is running, which writes every day an definition-exe.

The problem is, that the version of the definition-exe is namend in the filename, like def24444.exe.

On every update, the filename varied.

I need the filename to run the program, i tested "run("def*.exe")", dont work.

So i tried to get the name via FileFindFirstFile(), but that returns 0 and no name :/

Some ideas?

Share this post

Link to post
Share on other sites

This was taken directly from the help menu, and it worked fine for me.


; Shows the filenames of all files in the current directory, note that "." and ".." are returned.
$search = FileFindFirstFile("def*.exe")  

; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    MsgBox(4096, "File:", $file)

; Close the search handle

You just need to select the directory it will be stored at, then it will display every file that matches the description. You will need to fine tune it to find the specific file you want though.


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  

  • Create New...