I don’t know of another option besides VBScript to accomplish tasks on a Windows Endpoint with no external dependencies. I wrote this script to return the contents of a zip file on the command line to be redirected to a file and used in subsequent relevance substitution in the ActionScript of a task.
Usage: zipGetFilesList.vbs "PATH\TO\FILE.ZIP"
Result: List of files contained within the ZIP file.
This script was written to be eventually included and used within this task: http://bigfix.me/fixlet/details/3968
' zipGetFilesList.vbs
' Written by James Stewart ( @jgstew )
' Public Domain - use at your own risk
Dim strZipFilePath, objShell, objFiles, objCurrentFolder
' http://blogs.technet.com/b/heyscriptingguy/archive/2006/04/05/how-can-i-determine-the-path-to-the-folder-where-a-script-is-running.aspx
' http://stackoverflow.com/questions/4200028/vbscript-list-all-pdf-files-in-folder-and-subfolders
Set objCurrentFolder = CreateObject("Scripting.FileSystemObject").GetFolder( CreateObject("Wscript.Shell").CurrentDirectory )
' https://technet.microsoft.com/en-us/library/ee156618.aspx
If 1 = WScript.Arguments.Unnamed.Count Then
strZipFilePath = WScript.Arguments.Unnamed.Item(0)
Else
' operating on a ZIP in the current folder ( if there are multiple, the last one will be used )
For Each objFile in objCurrentFolder.Files
If UCase( CreateObject("Scripting.FileSystemObject").GetExtensionName(objFile.name)) = "ZIP" Then
strZipFilePath = objFile.Path
End If
Next
If IsEmpty( strZipFilePath ) Then
Wscript.Echo
Wscript.Echo "-ERROR-"
Wscript.Echo " Usage: zipGetFilesList.vbs ""PATH\TO\FILE.ZIP"" "
Wscript.Quit
End If
End If
Wscript.Echo strZipFilePath
Set objShell = CreateObject( "Shell.Application" )
Set objFiles = objShell.NameSpace( strZipFilePath ).Items( )
For Each item in objFiles
WScript.Echo item
Next
ActionScript:
delete __createfile
delete __Download\zipGetFilesList.vbs
createfile until END_OF_FILE
{ " replace this entire line with the above VBScript" }
END_OF_FILE
move __createfile __Download\zipGetFilesList.vbs
waithidden cmd /c cscript /nologo "{ pathname of file "zipGetFilesList.vbs" of folder "__Download" of client folder of current site }" "{ pathname of file whose(name of it as lowercase ends with ".zip") of folder "__Download" of client folder of current site }" > "{ pathname of folder "__Download" of client folder of current site }\zipFilesList.txt"