Jump to content

Stip hotfixes to kbxxxxxx.exe


JimC
 Share

Recommended Posts

I have a directory of which houses hotfixes in the following format. I would like to create a subdirectory which will house the hotfixes with everything stripped but kbxxxxxx.exe

c:\hotfix\WindowsInstaller-KB893803-v2-x86.exe

c:\hotfix\WindowsMedia-KB911564-x86-ENU.exe

c:\hotfix\WindowsXP-KB873339-x86-ENU.exe

c:\hotfix\WindowsXP-KB883667-x86-enu.exe

would like

c:\hotfix\stripped\

kb893803.exe

kb911564.exe

kb873339.exe

kb883667.exe

Link to comment
Share on other sites

Try something like this, (Works if there are nothing but Hotfix .exes in the folder.

Note: This is untested...Obviously.

#Include <String.au3>

$Path = "C:\Hotfix\"
$Search = FileFindFirstFile($Path&"*.exe")
If $search = -1 Then
    MsgBox(0, "Error", "No Hotfixes Found.")
    Exit
EndIf
While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    $Numbers= _StringBetween($File,"-KB","-");may need to adjust this line
    $Test= FileMove($Path&$File,$Path&"\Stripped\KB"&$Numbers[0]&".exe",8)
    If Not $Test then MsgBox(0,"Error", "FileMove Error")
WEnd
MsgBox(0,"Complete","Hotfix Stripping Finished.")
Edited by Paulie
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...