' The archive will be copied from the “Scripts” directory ' into the Temp directory and unpacked there ' Thereafter a Batch script will start that installs the files ' Andreas Nick 2016 ZipArchiv = "archiv.zip" TempFolder = "tempinst" 'extract here ZInstallBatch = Install.cmd” Set wshShell = CreateObject( "WScript.Shell" ) Set wshSystemEnv = wshShell.Environment( "SYSTEM" ) set fso = CreateObject("Scripting.FileSystemObject") 'Get Environment Temp = wshShell.ExpandEnvironmentStrings( wshSystemEnv( "TEMP" )) CurrentDirectory = fso.GetAbsolutePathName(".") ArchivePath = CurrentDirectory & "\" & ZipArchiv Set wshSystemEnv = Nothing Set wshShell = Nothing Set fso = Nothing 'Extract Archive ZipFile=ArchivePath wscript.echo "ZIP:" & ZipFile ExtractTo = temp & "\" & TempFolder Set fso = CreateObject("Scripting.FileSystemObject") If Not fso.FolderExists(Temp) Then fso.CreateFolder(Temp) End If fso.CopyFile ZipFile, temp & "\" If Not fso.FolderExists(ExtractTo) Then fso.CreateFolder(ExtractTo) End If 'Extract sourceFile = fso.GetAbsolutePathName(temp & ZipArchiv) destFolder = fso.GetAbsolutePathName(ExtractTo) Set objShell = CreateObject("Shell.Application") Set FilesInZip=objShell.NameSpace(sourceFile).Items() objShell.NameSpace(destFolder).copyHere FilesInZip, 16 'Execute installer Set WshShell = WScript.CreateObject("WScript.Shell") cmdpath = ExtractTo & "\" & ZInstallBatch wscript.echo cmdpath Wshshell.Run "%comspec% /c " & cmdpath, 0, True fso.DeleteFolder(ExtractTo) fso.DeleteFile(temp & "\" & ZipArchiv) Set WshShell= Nothing Set fso = Nothing Set objShell = Nothing Set FilesInZip = Nothing
To finish, the script must go in the DeploymentConfig.xml.
< MachineScripts> < AddPackage> < Path>CMD.EXE < Arguments>/c cscript.exe [{AppVPackageRoot}]\..\Scripts\Install.vbs < Wait RollbackOnError="true" Timeout="300" /> < /AddPackage> < /MachineScripts>
When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.
Comments 4
Hi, nice bloggpost.
There is actually a way to create folders directly in the script folder during seq. with a little hack I found out some while ago. It's explained in my blog https://how2appvirtualize.blogspot.com/2019/01/how-to-use-dynamic-scripting-in-your.html?m=1
Good read!
https://how2appvirtualize.blogspot.com/2019/01/how-to-use-dynamic-scripting-in-your.html?m=1
Yes, that is possible. You can simply paste the calls into the installation script :-)
Thank you, after that I have searched. Is it possible to start multiple installation scripts?