Caml Light Posted November 10, 2011 Author Share Posted November 10, 2011 (edited) Directory di C:\teststructure10/11/2011 20:23 <DIR> .10/11/2011 20:23 <DIR> ..08/11/2011 20:51 45.569 batch.cmd10/11/2011 20:20 <DIR> Dir10/11/2011 20:20 <DIR> Tools 1 File 45.569 byte Directory di C:\teststructure\Dir10/11/2011 20:20 <DIR> .10/11/2011 20:20 <DIR> ..10/11/2011 20:20 <DIR> Temp 0 File 0 byte Directory di C:\teststructure\Dir\Temp10/11/2011 20:20 <DIR> .10/11/2011 20:20 <DIR> .. 0 File 0 byte Directory di C:\teststructure\Tools10/11/2011 20:20 <DIR> .10/11/2011 20:20 <DIR> ..18/04/2011 19:54 941.568 7z.dll18/04/2011 19:34 168.448 7z.exe 2 File 1.110.016 byteIn the "Dir" directory i put the updates, now is empty, while in the "Temp" subdir i'll extract the zipped updates found in "Dir". Edited November 10, 2011 by Caml Light Link to comment Share on other sites More sharing options...
Yzöwl Posted November 10, 2011 Share Posted November 10, 2011 Microsoft's updates don't come in zip files! Link to comment Share on other sites More sharing options...
Caml Light Posted November 10, 2011 Author Share Posted November 10, 2011 (edited) sometimes i decide to zip them to save space when i put them in my fullest USB pen drive So, this is a condition to consider for the batch. Edited November 10, 2011 by Caml Light Link to comment Share on other sites More sharing options...
jaclaz Posted November 10, 2011 Share Posted November 10, 2011 (edited) sometimes i decide to zip them to save space when i put them in my fullest USB pen drive So, this is a condition to consider for the batch.Well, for the record not really, no.It is a condition you imposed.The issue I see is that if you have EITHER:ONLY non-zipped filesOR:ONLY zipped filesTHEN the file name sort sequential processing MAY make sense, BUT if you have a "mixed set of files" the order in which they are processed may well become a BIG problem. In such a setup I would rather use a verified sorted list instead.jaclaz Edited November 10, 2011 by jaclaz Link to comment Share on other sites More sharing options...
allen2 Posted November 11, 2011 Share Posted November 11, 2011 Just to satisfy my curiosity, how much space do you gain by compressing already compressed updates (please post the total space used by updates before and after) ? Link to comment Share on other sites More sharing options...
Caml Light Posted November 11, 2011 Author Share Posted November 11, 2011 Just to satisfy my curiosity, how much space do you gain by compressing already compressed updates (please post the total space used by updates before and after) ?right consideration , only using x86 post-SP1 updates for Windows 7 compressed with 7-Zip (.7z ext) 272MB -> 259MB (13MB earned), only for ONE O.S.! not bad (at least for me, clear )Coming back in topic, have you others suggestions for me after having seen my batch structure? Thanks Link to comment Share on other sites More sharing options...
jaclaz Posted November 11, 2011 Share Posted November 11, 2011 And, AGAIN, can you post an example of a POPULATED by the actual fles directory structure? Can you READ my previous post? Do you understand that until now what you propose is to process first all 7-zip compressed files (or ZIPped, you posted CONTRASTING info on this) and later all "normal" SFX .exe files (or the other way round first all the .exe's and then all the .7z's) and that this may not be a smart move as it may alter the proper order in which the updates should be installed? jaclaz Link to comment Share on other sites More sharing options...
gunsmokingman Posted November 11, 2011 Share Posted November 11, 2011 Here is what I understand, could be wrong1:\ He has uncompressed updates in one folder2:\ He has compressed updates in another3:\ He want to extract compressed ones then install allHere is a VBS script only tested to run without errors without testing these Install Updates or Extract UpdatesItem In The Script You Need To Change Or CheckZip Path For 7z. This assume the script location is the Parent Directory With a folder called Tools EG USB_DriveLetter:\Tools\Dim Zip :Zip = Act.CurrentDirectory & "\Tools\"ExtractChange From '-> UnComment To Make Active Run 7z Extract' Act.Run(Zip & "7z x " & c34 & Obj.Path & c34 & " -o" & Ext & " -y")Change To '-> UnComment To Make Active Run 7z Extract Act.Run(Zip & "7z x " & c34 & Obj.Path & c34 & " -o" & Ext & " -y")Install UpdatesChange From '-> UnComment To Make Active Run Install' Act.Run(c34 & Obj & c34 & " /quiet /norestart"),1,True Change To '-> UnComment To Make Active Run Install Act.Run(c34 & Obj & c34 & " /quiet /norestart"),1,True Save As ExtInstallKb.vbs this script will run and Produce a text file without changes''-> Object For Run TimeDim Act :Set Act = CreateObject("Wscript.Shell")Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")'-> Varibles Used At Run TimeDim c34 :c34 = Chr(34) Dim Zip :Zip = Act.CurrentDirectory & "\Tools\"Dim Ext :Ext = Act.ExpandEnvironmentStrings("%tmp%\KbInstall")Dim Rpt :Rpt = Act.ExpandEnvironmentStrings("%tmp%\KbInstall\KbRpt.txt")'-> Varibles For Loop And Text StreamDim Col, Chk, Obj, Ts '-> Create Temp Folder If Not Fso.FolderExists(Ext) Then Fso.CreateFolder(Ext)'-> Open Text Report Set Ts = Fso.CreateTextFile(Rpt) Ts.WriteLine " Script Date : " & Year(Now) & "-" & _ MonthName(Month(Now),False) & "-" & _ WeekdayName(Weekday(Now),False) & "," & Day(Date) Ts.WriteLine " Script Time : " & Hour(Time) & ":" & _ Minute(Time) & ":" & Second(Time) & vbCrLf '-> Recursive(Fso.GetFolder("."))' Uses Script Location As Parent Folder To Start Recursive Search ' Of All Folders And There Sub Folders Recursive(Fso.GetFolder(".")) If Chk = True Then Ts.WriteLine vbCrLf & " Installing Updates In : " & Fso.GetFolder(Ext).Path'-> Loop Threw Updates In Temp Folder For Each Obj In Fso.GetFolder(Ext).Files If Right(InStr(1,Obj.Name,"msu",1),3) Or _ Right(InStr(1,Obj.Name,"ms1",1),3) Or _ Right(InStr(1,Obj.Name,"exe",1),3) Then Ts.WriteLine " Install Update : " & Obj.Path'-> Remove Only For Demo Show KB Unstall Command Ts.WriteLine "Act.Run(" & c34 & Obj & c34 & " /quiet /norestart" & "),1,True"'-> UnComment To Make Active' Act.Run(c34 & Obj & c34 & " /quiet /norestart"),1,True End If Next Else Ts.WriteLine vbCrLf & " Nothing was extracted or installed." End If '-> Close The Report Ts.Close()'-> Open The Report To Read Act.Run(c34 & Rpt & c34),1,True'-> Ask To Keep Or Delete Report If MsgBox("Would You Like To Keep This Report",4132, _ "Keep Or Delete") = 6 Then Fso.CopyFile Rpt, Act.SpecialFolders("Desktop") & "\KbRpt.txt",True End If '-> Delete The Temp Folder If Fso.FolderExists(Ext) Then Fso.DeleteFolder(Ext)'-> List All Folders And Files Function Recursive(Folder) Ts.WriteLine vbCrLf & " Searching Folder: " & Folder For Each Obj In Folder.Files'-> Filter Out Script From Being Process If Not InStr(1,Obj.Path,WScript.ScriptFullName,1) Then'-> Filter Out Updates By Name If InStr(1,Obj.Name,"kb7",1) Or InStr(1,Obj.Name,"kb8",1) Or _ InStr(1,Obj.Name,"kb9",1) Then If Right(InStr(1,Obj.Name,"msu",1),3) Then Chk = True Ts.WriteLine " Confirm Update : " & Obj.Name Fso.CopyFile Obj, Ext & "\", True ElseIf Right(InStr(1,Obj.Name,"zip",1),3) Then Ts.WriteLine " Confirm Zip KB : " & Obj Chk = True '-> Remove Only For Demo Show 7z File For Extract To Where It Extracted To Ts.WriteLine "Act.Run(" & Zip & "7z x " & c34 & Obj.Path & c34 & " -o" & c34 & Ext & c34 & " -y),1,true"'-> UnComment To Make Active' Act.Run(Zip & "7z x " & c34 & Obj.Path & c34 & " -o" & Ext & " -y") End If End If End If Next 'Ts.WriteLine For Each Col In Folder.SubFolders Recursive(Col) Next End FunctionRename ExtInstallKb.vbs.txt from to ExtInstallKb.vbs to make active script. This will run and Produce a text file without changes or errorsExtInstallKb.vbs.txt Link to comment Share on other sites More sharing options...
Caml Light Posted November 14, 2011 Author Share Posted November 14, 2011 Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now