问题描述
我编写了一些非常有趣的代码来压缩多个文件和文件夹.
脚本将获取参数列表(文件和文件夹)并将它们压缩到一个以日期/时间为名称的 zip 文件中.
所以我需要一些在参数是文件时执行的代码.代码应将文件的目录结构添加到 zip 文件中.
'==================== 脚本 ======================================'获取命令行参数.设置 objArgs = WScript.ArgumentsSet objShell = CreateObject("Shell.Application")''C:\DateYYYY-MM-DD_TimeHH-MM-SS.zipZipFile = "C:\DateYYYY-MM-DD_TimeHH-MM-SS.zip"'创建空的 ZIP 文件.CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" &Chr(5) &Chr(6) &字符串(18,vbNullChar)设置 zip = objShell.NameSpace(ZipFile)'对于 i = 0 到 objArgs.Count-1出错时继续下一步IF fnFileExists( objArgs(i) ) OR (NOT fnFolderIsEmpty(objArgs(i) )) THEN'WScript.Echo "复制-" &objArgs(i)如果 fnFileExists( objArgs(i) ) THEN'???Code/Function/CopyHere[option] 在 zip 中创建目录结构并将 objArgs(i) 文件复制到其中万一zip.CopyHere( objArgs(i) )别的WScript.Echo "Empty or !Exist - " &objArgs(i)万一做wScript.Sleep 200循环直到 objShell.NameSpace(zip).Items.Count >= i下一个WScript.Echo结束"
fnFileExists()
函数仅在文件存在时返回 TRUE
(如果文件夹或文件不存在,则FALSE
).>
如果文件夹为空或不存在,fnFolderIsEmpty()
函数返回 TRUE
.
给出这样的调用:
"wscript zip.vbs "c:\Folder1\" "c:\Folder2\Sub2-1\" "c:\Windows\System32\TestFile0.txt"
文件夹在哪里:
\Folder1\└──TestFile1.txt└──TestFile2.txt\文件夹2\└──\Sub2-1\└──TestFile3.txt└──TestFile4.txt\视窗\└──\System32\└──TestFile0.txt└──\Sub3-2\└──TestFoo.txt
我得到一个结构如下的 zip 文件:
\Folder1\└──TestFile1.txt└──TestFile2.txt\Sub2-1\└──TestFile3.txt└──TestFile4.txt\TestFile0.txt
这是我想要的样子:
\Folder1\└──TestFile1.txt└──TestFile2.txt\文件夹2\└──\Sub2-1\└──TestFile3.txt└──TestFile4.txt\视窗\└──\System32\└──TestFile0.txt
我确实找到了以下内容,但我不知道 Java 如何/是否转换为 VBScript:
java.util.zip - 重新创建目录结构
-AND-
压缩文件保留目录结构
好的,就是这样.对于每个单独的文件,我将它放在一个临时文件夹(C:\xxMisc")中,在临时文件夹下创建完整路径.然后我压缩临时文件夹中的所有文件夹.非常适合我的目的.
例如如果我需要压缩c:\windows\system32\bob.dll"我会创建一个路径\文件c:\xxMisc\windows\system32\"&将 bob.dll 复制到其中.然后调用: zip.MoveHere( "c:\xxMisc\Windows" );
结果是 zip 文件将有一个\windows\"目录,其中包含所有子目录(和文件).
用法: wscript [/x]
[] 参数是可选的.通配符不起作用.以\"结束完整路径."/x" 将打开一个 IE 调试窗口.wscript script.vbs/X "C:\My Path\" "c:\windows\system32\bob.dll"
结果:位于c:\"的 zip 文件将包含整个目录c:\My Path\"(包括文件和子目录)和\windows\system32\"中的 bob.dll" 目录路径.
这是代码.
IF WScript.Arguments.Count = 0 THENWSScript.退出万一昏暗的 objIEDebugWindowsTempFolderName = "C:\xxMisc" '各个文件的去向iBeforeCopy = 0 '检测移动/复制何时完成的值bDebug = FALSE '调试标志i = 0 '通过 objArgs() 索引'获取命令行参数.设置 objArgs = wScript.Arguments'一般对象Set objShell = CreateObject("Shell.Application")Set objFSO = CreateObject("Scripting.FileSystemObject")'检测调试命令行参数 |必须是第一个参数IF UCase( objArgs( 0 ) ) = "/X" THENb调试=真i = 1 '更改哪个索引 objArgs() 开始查找文件/文件夹万一'测试 Windows Script Host 是否 >= 2.0fnCheckWSHversion(2000)'创建空的 ZIP 文件.'C:\DateYYYY-MM-DD_TimeHH-MM-SS.zipZipFile = "C:\Date" &年(日) &"-" &Right("0" & Month(Date),2) &"-" &Right("0" & Day(Date),2) &_时间"&Right("0" & Hour(now), 2) &"-" &Right("0" & Minute(now), 2) &"-" &Right("0" & Second(now), 2) &.压缩"CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" &Chr(5) &Chr(6) &字符串(18,vbNullChar)设置 zip = objShell.NameSpace(ZipFile)调用调试(objArgs.Count)'遍历命令行参数对于 i = i 到 objArgs.Count-1CALL Debug( "Processing objArgs = " & i & "| " & objArgs(i) )IF FileExists( objArgs(i) ) OR (NOT fnFolderIsEmpty(objArgs(i) )) THENIF FileExists( objArgs(i) ) THEN'这是一个文件CALL Debug("复制文件-" & objArgs(i))调用 fnMakeTempFile( sTempFolderName, objArgs( i ) )否则'这是一个文件夹CALL Debug("复制文件夹-" & objArgs(i))iBeforeCopy = objShell.NameSpace(zip).Items.Countzip.CopyHere( objArgs(i) )'等到复制完成(Items.Count 上升)做wScript.Sleep 200循环直到 objShell.NameSpace(zip).Items.Count >复制前万一别的CALL Debug( "Empty or !Exist - " & objArgs(i) )万一下一个IF (NOT fnFolderIsEmpty( "c:\xxMisc" )) THEN '以防万一没有文件被备份'获取临时文件夹的ArrayList设置 arrDirs = fnListDirIn("c:\xxMisc")调用调试(复制 sTempFolder")对于 arrDirs 中的每个 sFolderNameCALL Debug( "sFolderName=" & sFolderName )iBeforeCopy = objShell.NameSpace(zip).Items.Countzip.MoveHere( sFolderName )'等到复制完成(Items.Count 上升)做wScript.Sleep 200循环直到 objShell.NameSpace(zip).Items.Count >复制前下一个调用调试(复制完成!")CALL Debug( "删除 sTempFolderName = " & sTempFolderName )objFSO.DeleteFolder sTempFolderName, TRUE'等待文件夹删除完成;因为 MoveHere 不会移动而 objFSO.FolderExists( sTempFolderName )wScript.Sleep 200温德万一调用调试(结束")CALL MsgBox( "备份完成", vbOKOnly+vbInformation, "我的备份")设置 objArgs = 无设置 objShell = 无设置 objFSO = 无设置 zip = 无wScript.退出' ----------------------------------------------'结束主要' ----------------------------------------------' ----------------------------------------------'将 sFileName 复制到 sTempFolder 指定的临时目录中' 例如:' sTempFolder = "C:\Temp\"'sFileName = "c:\Windows\System32\bob.ocx"' 结果是C:\Temp\Windows\System32\bob.ocx"的创建'-使用 fnCreatePath()'-没有回报函数 fnMakeTempFile( ByVal sTempFolder, sFileName )如果正确(sTempFolder,1)<>\"然后sTempFolder = sTempFolder &\"万一设置 objFile = objFSO.GetFile(sFileName)FilePath = objFSO.GetParentFolderName( objFile )文件路径 = sTempFolder &中(文件路径,4)fnCreatePath( 文件路径 )CALL Debug( "FILECOPY = "& objFile.Name &" -> FilePath = " & FilePath )objFile.Copy( FilePath & "\" & objFile.Name )虽然不是 objFSO.FileExists( FilePath & "\" & objFile.Name )wScript.Sleep 200调用调试(文件复制等待")温德调用调试(临时文件复制完成")设置 objFile = 无结束函数' ----------------------------------------------'递归创建文件夹路径'基于脚本:'http://www.techcoil.com/blog/handy-vbscript-functions-for-dealing-with-zip-files-and-folders/函数 fnCreatePath( folderUrl )folderUrl = objFSO.GetAbsolutePathName(folderUrl)如果 (不是 objFSO.folderExists(objFSO.GetParentFolderName(folderUrl))) 那么' 递归调用 CreateFolder 来创建父文件夹fnCreatePath(objFSO.GetParentFolderName(folderUrl))万一' 如果父文件夹存在则创建当前文件夹如果 (不是 objFSO.FolderExists(folderUrl)) 那么CALL Debug( "fnCreatePath; FolderURL = " & folderUrl )objFSO.CreateFolder(folderUrl)万一结束函数' ----------------------------------------------' 如果文件夹为 Empty 或 !Exist 将返回 TRUE函数 fnFolderIsEmpty( sFolderName )Dim objFolderFSO '文件系统对象昏暗的对象文件夹Set objFolderFSO = CreateObject("Scripting.FileSystemObject")出错时继续下一步fnFolderIsEmpty = TRUE '如果不存在则返回 TRUE如果 objFolderFSO.FolderExists( sFolderName ) 那么设置 objFolder = objFolderFSO.GetFolder( sFolderName )如果 objFolder.Files.Count = 0 并且 objFolder.SubFolders.Count = 0 那么fnFolderIsEmpty = TRUE别的fnFolderIsEmpty = FALSE万一万一objFolderFSO = 没有objFolder = 无结束函数' ----------------------------------------------'目的:如果文件存在,即使它是隐藏的,也返回真.'参数:strFile:要查找的文件名.如果不包含路径,则搜索当前目录.'注意:不查看文件的子目录.'作者:艾伦布朗.http://allenbrowne.com,2006 年 6 月.函数 FileExists( strFile )出错时继续下一步昏暗的 fsoSet fso = CreateObject("Scripting.FileSystemObject")如果 (fso.FileExists( strFile )) 然后文件存在 = 真别的文件存在 = FALSE万一fso = 没有结束函数'---------------------------------------------------------------'基于:http://blogs.msdn.com/b/gstemp/archive/2004/08/11/213028.aspx' 返回在 sDirectory 中找到的文件夹的 ArrayList函数 fnListDirIn( ByVal sDirectory )Set objWMIService = GetObject("winmgmts:\\.")CALL Debug("fnListDirIn() Path="& sDirectory)设置 colFolders = objWMIService.ExecQuery _("{Win32_Directory.Name='" & sDirectory & "'} 的关联" _&WHERE AssocClass = Win32_Subdirectory"_&"ResultRole = PartComponent")Set arrNames = CreateObject("System.Collections.ArrayList")对于 colFolders 中的每个 objFolderCALL Debug( "fnListDirIn 添加文件夹=" & objFolder.Name )arrNames.Add( objFolder.name )下一个'colFolders = Nothing ?为什么会失败?'objFolder = Nothing ?为什么会失败?设置 fnListDirIn = arrNames结束函数' ----------------------------------------------'检查可用的 Windows 脚本主机版本' - 如果不可用则退出脚本'基于:http://www.robvanderwoude.com/vbstech_debugging.php函数 fnCheckWSHversion( ByVal iMinVer )intMajorVerion = 0 + CInt( Mid( WScript.Version, 1, InStr( WScript.Version, "." ) - 1 ) )intMinorVerion = 0 + CInt( Mid( WScript.Version, InStr( WScript.Version, "." ) + 1 ) )intCheckVersion = 1000 * intMajorVerion + intMinorVerionCALL Debug( "WSH Version = " & intCheckVersion )如果 intCheckVersion "&vbCrLf'不要设置 objIEDebugWindow = Nothing;会走结束子
让我知道你的想法.谢谢.
I've hacked together some pretty interesting code to zip multiple files and folders.
The script will take a list of arguments (files & folders) and zips them to a zip with the date/time as the name.
So I need some code that is executed when the argument is a file. The code should add the directory structure of the file to the zip file.
'=================== THE SCRIPT =====================================
'Get command-line arguments.
Set objArgs = WScript.Arguments
Set objShell = CreateObject("Shell.Application")
'
'C:\DateYYYY-MM-DD_TimeHH-MM-SS.zip
ZipFile = "C:\DateYYYY-MM-DD_TimeHH-MM-SS.zip"
'Create empty ZIP file.
CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar)
Set zip = objShell.NameSpace(ZipFile)
'
for i = 0 To objArgs.Count-1
On Error Resume Next
IF fnFileExists( objArgs(i) ) OR (NOT fnFolderIsEmpty( objArgs(i) )) THEN
'WScript.Echo "Copying - " & objArgs(i)
IF fnFileExists( objArgs(i) ) THEN
'??? Code/Function/CopyHere[option] to create a directory structure in zip and copy objArgs(i) file into it
End If
zip.CopyHere( objArgs(i) )
Else
WScript.Echo "Empty or !Exist - " & objArgs(i)
End If
Do
wScript.Sleep 200
Loop Until objShell.NameSpace(zip).Items.Count >= i
Next
WScript.Echo "THE END"
The fnFileExists()
function returns TRUE
only if the file exists (FALSE
if folder or file doesn't exist).
The fnFolderIsEmpty()
function returns TRUE
if folder is empty or doesn't exist.
Given a call like this:
"wscript zip.vbs "c:\Folder1\" "c:\Folder2\Sub2-1\" "c:\Windows\System32\TestFile0.txt"
Where folders are like this:
\Folder1\
└──TestFile1.txt
└──TestFile2.txt
\Folder2\
└──\Sub2-1\
└──TestFile3.txt
└──TestFile4.txt
\Windows\
└──\System32\
└──TestFile0.txt
└──\Sub3-2\
└──TestFoo.txt
I get a zip file with a structure like this:
\Folder1\
└──TestFile1.txt
└──TestFile2.txt
\Sub2-1\
└──TestFile3.txt
└──TestFile4.txt
\TestFile0.txt
This is what I'd LIKE it to look like:
\Folder1\
└──TestFile1.txt
└──TestFile2.txt
\Folder2\
└──\Sub2-1\
└──TestFile3.txt
└──TestFile4.txt
\Windows\
└──\System32\
└──TestFile0.txt
I did find the following, but I don't know how/if Java translates to VBScript:
java.util.zip - Recreating directory structure
-AND-
Zipping files preserving the directory structure
OK, here it is.For every individual file, I put it in a temp folder ("C:\xxMisc") creating the full path underneath the temp folder. I then zip all the folders in the temp folder. Works perfect for my purposes.
e.g. If I needed to zip "c:\windows\system32\bob.dll"I would create a path\file "c:\xxMisc\windows\system32\" & copy bob.dll into it.Then call: zip.MoveHere( "c:\xxMisc\Windows" );
The result is that the zip file would have a "\windows\" directory with all the sub-directories (and files) in it.
Usage: wscript <script.vbs> [/x] <FullPath[FileName]>
[]arguments are optional. Wild cards do not work. End full paths with '\'. "/x" will bring up a IE debug window.wscript script.vbs /X "C:\My Path\" "c:\windows\system32\bob.dll"
Result: zip file at "c:\" that will contain the entire directory "c:\My Path\" (including files & subdirectories) and bob.dll in a "\windows\system32\" directory path.
Here is the code.
IF WScript.Arguments.Count = 0 THEN
WSCript.Quit
END IF
Dim objIEDebugWindow
sTempFolderName = "C:\xxMisc" 'Where individual files go
iBeforeCopy = 0 'Value to detect when a move/copy is complete
bDebug = FALSE 'Debug Flag
i = 0 'Index through the objArgs()
'Get command-line arguments.
Set objArgs = wScript.Arguments
'General objects
Set objShell = CreateObject("Shell.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Detect Debug Command Line Argument | MUST be FIRST Argument
IF UCase( objArgs( 0 ) ) = "/X" THEN
bDebug = TRUE
i = 1 'Change Which Index objArgs() to start looking for files/folders
END IF
'Test to see if Windows Script Host is >= 2.0
fnCheckWSHversion( 2000 )
'Create empty ZIP file.
'C:\DateYYYY-MM-DD_TimeHH-MM-SS.zip
ZipFile = "C:\Date" & Year(Date) & "-" & Right("0" & Month(Date),2) & "-" & Right("0" & Day(Date),2) & "_Time" & Right("0" & Hour(now), 2) & "-" & Right("0" & Minute(now), 2) & "-" & Right("0" & Second(now), 2) & ".zip"
CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar)
Set zip = objShell.NameSpace(ZipFile)
CALL Debug ( objArgs.Count )
'Iterate through the command line arguments
for i = i To objArgs.Count-1
CALL Debug( "Processing objArgs = " & i & "| " & objArgs(i) )
IF FileExists( objArgs(i) ) OR (NOT fnFolderIsEmpty( objArgs(i) )) THEN
IF FileExists( objArgs(i) ) THEN
'IT'S A FILE
CALL Debug( "Copying File - " & objArgs(i) )
CALL fnMakeTempFile( sTempFolderName, objArgs( i ) )
Else 'IT'S A FOLDER
CALL Debug( "Copying Folder - " & objArgs(i) )
iBeforeCopy = objShell.NameSpace(zip).Items.Count
zip.CopyHere( objArgs(i) )
'Wait until copy is done (Items.Count goes up)
Do
wScript.Sleep 200
Loop Until objShell.NameSpace(zip).Items.Count > iBeforeCopy
End If
Else
CALL Debug( "Empty or !Exist - " & objArgs(i) )
End If
Next
IF (NOT fnFolderIsEmpty( "c:\xxMisc" )) THEN 'Just in case no FILES were backed up
'Get ArrayList of Temp Folders
Set arrDirs = fnListDirIn( "c:\xxMisc" )
CALL Debug( "Copying sTempFolder" )
For Each sFolderName in arrDirs
CALL Debug( "sFolderName=" & sFolderName )
iBeforeCopy = objShell.NameSpace(zip).Items.Count
zip.MoveHere( sFolderName )
'Wait until copy is done (Items.Count goes up)
Do
wScript.Sleep 200
Loop Until objShell.NameSpace(zip).Items.Count > iBeforeCopy
Next
CALL Debug( "COPY DONE!" )
CALL Debug( "Deleting sTempFolderName = " & sTempFolderName )
objFSO.DeleteFolder sTempFolderName, TRUE
'Wait until folder is finished deleting; because MoveHere doesn't MOVE
While objFSO.FolderExists( sTempFolderName )
wScript.Sleep 200
Wend
END IF
CALL Debug( "THE END" )
CALL MsgBox( "Backup Complete", vbOKOnly+vbInformation, "My Backup" )
Set objArgs = Nothing
Set objShell = Nothing
Set objFSO = Nothing
Set zip = Nothing
wScript.Quit
' ----------------------------------------------
'END MAIN
' ----------------------------------------------
' ----------------------------------------------
'Copies sFileName into a temporary directory specified by sTempFolder
' e.g.:
' sTempFolder = "C:\Temp\"
' sFileName = "c:\Windows\System32\bob.ocx"
' results is the creation of "C:\Temp\Windows\System32\bob.ocx"
'-Uses fnCreatePath()
'-No Return
Function fnMakeTempFile( ByVal sTempFolder, sFileName )
IF Right( sTempFolder, 1 ) <> "\" THEN
sTempFolder = sTempFolder & "\"
End If
Set objFile = objFSO.GetFile( sFileName )
FilePath = objFSO.GetParentFolderName( objFile )
FilePath = sTempFolder & Mid(FilePath, 4)
fnCreatePath( FilePath )
CALL Debug( "FILECOPY = "& objFile.Name &" -> FilePath = " & FilePath )
objFile.Copy( FilePath & "\" & objFile.Name )
While NOT objFSO.FileExists( FilePath & "\" & objFile.Name )
wScript.Sleep 200
CALL Debug( "FileCopy Waiting" )
Wend
CALL Debug( "Temp FileCopy Completed" )
Set objFile = Nothing
End Function
' ----------------------------------------------
'Recursively creates a folder path
'Based on script from:
'http://www.techcoil.com/blog/handy-vbscript-functions-for-dealing-with-zip-files-and-folders/
Function fnCreatePath( folderUrl )
folderUrl = objFSO.GetAbsolutePathName(folderUrl)
If (Not objFSO.folderExists(objFSO.GetParentFolderName(folderUrl))) then
' Call CreateFolder recursively to create the parent folder
fnCreatePath(objFSO.GetParentFolderName(folderUrl))
End If
' Create the current folder if the parent exists
If (Not objFSO.FolderExists(folderUrl)) then
CALL Debug( "fnCreatePath; FolderURL = " & folderUrl )
objFSO.CreateFolder(folderUrl)
End If
End Function
' ----------------------------------------------
' Will return TRUE if folder is Empty or !Exist
Function fnFolderIsEmpty( sFolderName )
Dim objFolderFSO 'FileSystemObject
Dim objFolder
Set objFolderFSO = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
fnFolderIsEmpty = TRUE 'Return TRUE if it doesn't exist either
If objFolderFSO.FolderExists( sFolderName ) Then
Set objFolder = objFolderFSO.GetFolder( sFolderName )
If objFolder.Files.Count = 0 And objFolder.SubFolders.Count = 0 Then
fnFolderIsEmpty = TRUE
Else
fnFolderIsEmpty = FALSE
End If
End If
objFolderFSO = Nothing
objFolder = Nothing
End Function
' ----------------------------------------------
'Purpose: Return True if the file exists, even if it is hidden.
'Arguments: strFile: File name to look for. Current directory searched if no path included.
'Note: Does not look inside subdirectories for the file.
'Author: Allen Browne. http://allenbrowne.com June, 2006.
Function FileExists( strFile )
On Error Resume Next
DIM fso
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists( strFile )) Then
FileExists = TRUE
Else
FileExists = FALSE
End If
fso = Nothing
End Function
'---------------------------------------------------------------
'Based on: http://blogs.msdn.com/b/gstemp/archive/2004/08/11/213028.aspx
' Returns ArrayList of folders found in sDirectory
Function fnListDirIn( ByVal sDirectory )
Set objWMIService = GetObject("winmgmts:\\.")
CALL Debug( "fnListDirIn() Path=" & sDirectory )
Set colFolders = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='" & sDirectory & "'} " _
& "WHERE AssocClass = Win32_Subdirectory " _
& "ResultRole = PartComponent")
Set arrNames = CreateObject("System.Collections.ArrayList")
For Each objFolder in colFolders
CALL Debug( "fnListDirIn Add Folder=" & objFolder.Name )
arrNames.Add( objFolder.name )
Next
'colFolders = Nothing ?Why does this fail?
'objFolder = Nothing ?Why does this fail?
Set fnListDirIn = arrNames
End Function
' ----------------------------------------------
'Checks available Windows Scripting Host Version
' - Quit Script if not available
'Based on: http://www.robvanderwoude.com/vbstech_debugging.php
Function fnCheckWSHversion( ByVal iMinVer )
intMajorVerion = 0 + CInt( Mid( WScript.Version, 1, InStr( WScript.Version, "." ) - 1 ) )
intMinorVerion = 0 + CInt( Mid( WScript.Version, InStr( WScript.Version, "." ) + 1 ) )
intCheckVersion = 1000 * intMajorVerion + intMinorVerion
CALL Debug( "WSH Version = " & intCheckVersion )
If intCheckVersion < iMinVer Then
WScript.Echo "Sorry, this script requires WSH " & iMinVer/1000 & " or later"
WScript.Quit intCheckVersion
End If
End Function
' ----------------------------------------------
' Dumps debug myText to an InternetExplorer Window
' Based on script from:
' http://www.robvanderwoude.com/vbstech_debugging.php
Sub Debug( myText )
' Uncomment the next line to turn off debugging
IF NOT bDebug THEN
Exit Sub
END IF
If Not IsObject( objIEDebugWindow ) Then
Set objIEDebugWindow = CreateObject( "InternetExplorer.Application" )
objIEDebugWindow.Navigate "about:blank"
objIEDebugWindow.Visible = True
objIEDebugWindow.ToolBar = False
objIEDebugWindow.Width = 200
objIEDebugWindow.Height = 300
objIEDebugWindow.Left = 10
objIEDebugWindow.Top = 10
Do While objIEDebugWindow.Busy
WScript.Sleep 100
Loop
objIEDebugWindow.Document.Title = "IE Debug Window"
objIEDebugWindow.Document.Body.InnerHTML = _
"<b>" & Now & "</b></br>"
End If
objIEDebugWindow.Document.Body.InnerHTML = _
objIEDebugWindow.Document.Body.InnerHTML _
& myText & "<br>" & vbCrLf
'Do NOT set objIEDebugWindow = Nothing; Will go away
End Sub
Let me know what you think. Thanks.
这篇关于压缩来自不同文件夹的文件,保留目录结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!