Jump to content

using the dos FOR command insite a script


 Share

Recommended Posts

I'm hoping someone can assist me on this one... I'm in the process of replacing a batch file with an autoit .exe file. This line in question is below.

for /f %%s in ('dir /b *.dll') do regsvr32 /s %%s

basically its supposed to scan a folder for all the .dll files, and then use the regsvr32 command to reregister them all.

any suggestions?

note: until today, i had no idea that the "for" command even existed as a dos command.

Thank You

Keilamym

Link to comment
Share on other sites

Dim $Filename

$Folder = @SystemDir & "\YourDLLFolder"
$search = FileFindFirstFile($Folder & '\*.dll')

If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $filename = FileFindNextFile($search)
    If @error Then ExitLoop
    
    $Filename = $Folder & '\' & $filename
    If StringRight($Filename, 3) = "dll" Then RunWait('regsvr32 /s "' & $Filename & '"', @SystemDir)
WEnd
FileClose($search)

Edited by SlimShady
Link to comment
Share on other sites

wow slim... THANK YOU...

i really appreciate the quick response... can i send you a tip or something?

Keilamym

<{POST_SNAPBACK}>

:idiot: If I would get 10 bucks for every time I helped someone, I would be a rich man. :D

You don't have to give me anything, I like helping people.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...