Jump to content

Renaming Hotfixes


Recommended Posts

Hi all, don't know if this has been shared before (did a quick search and couldn't find it), following is the core of a batch file I wrote to rename hotfixes to KBxxxxxx.exe format. Saves manually doing it.

Note: I found that it does not work with the .NET hotfixes, and have not yet looked at WMP and some others, but definately works with all the critical updates and most of the optional ones.

If anyone has anything better I'd be interested to see :thumbup

Is a bit messy as had to account for where the first line does not cater for all file names.

for %%v in (*-*-*-*.exe) do for /f "tokens=1-5 delims=-." %%k in ("%%v") do ren "%%v" "%%l.%%o"
for %%v in (*.ENU) do for /f "tokens=1-2 delims=." %%k in ("%%v") do ren "%%v" %%k.exe
for %%v in (*.x86) do for /f "tokens=1-2 delims=." %%k in ("%%v") do ren "%%v" %%k.exe
for %%v in (*.34) do for /f "tokens=1-2 delims=." %%k in ("%%v") do ren "%%v" %%k.exe
for %%v in (*-*-*.exe) do for /f "tokens=1-4 delims=-." %%k in ("%%v") do ren "%%v" "%%l.%%n"

Link to comment
Share on other sites


Ehm, why would you want to rename them?

I believe they are to be renamed for the Svcpack.inf

Here is another way to rename them using VBS script.

I have added comments to the script so it bigger then what needed.

Save as RenameKb.vbs

Option Explicit 
'/-> Object Used
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
'/-> Varibles
Dim F1, F2, F3, F4
'/-> Get Folder Path To This Script
Set F1 = Fso.GetFolder(Fso.GetParentFolderName(WScript.ScriptFullName))
'/-> Collect All The Files In This Script Folder
For Each F2 In F1.Files
'/-> Filter For Updates
If InStr(F2.Name,"KB") And InStr(F2.Name,".exe") Then
'/-> Split To Get Numbers
F3 = Split(F2.Name,"KB")
'/-> Rebuild New File Name
F4 = "KB" & Left(F3(1),6) & ".exe"
'/-> Used Copy Because True Means OverWriteExisting File
Fso.CopyFile F2.Name, F4 ,True
'/-> Delete Original Update
Fso.DeleteFile(F2.Path),True
End If
Next

Without Comments

Save as RenameKb.vbs

Option Explicit 
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim F1, F2, F3, F4
Set F1 = Fso.GetFolder(Fso.GetParentFolderName(WScript.ScriptFullName))
For Each F2 In F1.Files
If InStr(F2.Name,"KB") And InStr(F2.Name,".exe") Then
F3 = Split(F2.Name,"KB")
F4 = "KB" & Left(F3(1),6) & ".exe"
Fso.CopyFile F2.Name, F4 ,True
Fso.DeleteFile(F2.Path),True
End If
Next

Link to comment
Share on other sites

ooo like it, nice!

am learning as I go here, so bear with me :rolleyes:

yes, they are indeed renamed for svcpack.inf method.

I chose that (svcpack.inf) method because the company I am looking at this for would prefer that I didn't use any 3rd party progs like nLite to do this.

Although, am only using svcpack.inf for those that will not integrate using /integrate.

batch files are acceptable though :thumbup

have written a few that to help with the unattended process as well as including edits of some found in the guide here, and one of the slimming down guides also.

rely on having a folder structure set, simmilar to the way hfslip works I guess, but doesn't just do slipstreaming, copies all required files to correct %oem$ folders etc.

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
  • Recently Browsing   0 members

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