Показать сообщение отдельно

  #9  
Старый 13.02.2010, 13:24
Solker
Участник форума
Регистрация: 04.05.2006
Сообщений: 161
С нами: 10537558

Репутация: 158
По умолчанию

#Wolf#
Ну.. Эм.. Если Винды, то там есть чудо стандартный zip, который не умеет работать через консоль. Но можно создать архив через VBS.

Код:
Option Explicit

Const ForReading = 1, ForWriting = 2, ForAppending = 8

Dim MySource, MyTarget, MyZipName, MyHex, MyBinary, i
Dim oShell, oApp, oFolder, oCTF, oFile
Dim oFileSys

MySource = "c:\test"
MyTarget = "c:\test.zip"

MyHex = Array(80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)

For i = 0 To UBound(MyHex)
MyBinary = MyBinary & Chr(MyHex(i))
Next

Set oShell = CreateObject("WScript.Shell")
Set oFileSys = CreateObject("Scripting.FileSystemObject")


Set oCTF = oFileSys.CreateTextFile(MyTarget, True)
oCTF.Write MyBinary
oCTF.Close
Set oCTF = Nothing

Set oApp = CreateObject("Shell.Application")

Set oFolder = oApp.NameSpace(MySource)
If Not oFolder Is Nothing Then
oApp.NameSpace(MyTarget).CopyHere oFolder.Items
End If

wScript.Sleep(5000)


Set oFile = Nothing
On Error Resume Next
Do While (oFile Is Nothing)

Set oFile = oFileSys.OpenTextFile(MyTarget, ForAppending, False)
If Err.number <> 0 then
Err.Clear
wScript.Sleep 3000
End If
Loop

Set oFile=Nothing
Set oFileSys=Nothing
 
Ответить с цитированием