|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Ho can i create Zip Files via command-line?
Can be done via WMI? I don´t wann use WinZIP COmmand Line Add-On, because it is not freeware Can i use VBScript to do that? Other "Lnaguage" maybe? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
=?Utf-8?B?RkI=?= <FB@discussions.microsoft.com> wrote in news:BA2EBF27-
A76A-487C-8837-90D9D1BD8168@microsoft.com: > Ho can i create Zip Files via command-line? > Can be done via WMI? > > I don´t wann use WinZIP COmmand Line Add-On, because it is not freeware > > Can i use VBScript to do that? Other "Lnaguage" maybe? > How about a free command line ZIP utility instead of WinZIP? http://www.info-zip.org/ HTH, Wayne Tilton |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
"FB" <FB@discussions.microsoft.com> wrote in message news:BA2EBF27-A76A-487C-8837-90D9D1BD8168@microsoft.com... > Ho can i create Zip Files via command-line? > Can be done via WMI? > > I don´t wann use WinZIP COmmand Line Add-On, because it is not freeware > > Can i use VBScript to do that? Other "Lnaguage" maybe? Since Windows already knows how to deal with zip files to some extent you might want to try the following. No external programs are needed. Believe it or not the wscript.sleep at the end is important to make this work correctly. Const FOF_CREATEPROGRESSDLG = &H0& Const MyZip = "C:\..\MyZipFile.zip" Const File1 = "C:\..\File1.txt" Const File2 = "C:\..\File2.txt" Const MyDest = "C:\scratch" '-------------- create empty zip file --------- 'Create the basis of a zip file. CreateObject("Scripting.FileSystemObject") _ .CreateTextFile(MyZip, True) _ .Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar) '-------------- zip --------------------------- 'get ready to add files to zip With CreateObject("Shell.Application") 'add files .NameSpace(MyZip).CopyHere File1, FOF_CREATEPROGRESSDLG .NameSpace(MyZip).CopyHere File2 End With wScript.Sleep 1000 |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
"LJB" <postmaster@[127.0.0.1]> wrote in message news:Odh9kKG4IHA.1952@TK2MSFTNGP03.phx.gbl... > > "FB" <FB@discussions.microsoft.com> wrote in message > news:BA2EBF27-A76A-487C-8837-90D9D1BD8168@microsoft.com... >> Ho can i create Zip Files via command-line? >> Can be done via WMI? >> >> I don´t wann use WinZIP COmmand Line Add-On, because it is not freeware >> >> Can i use VBScript to do that? Other "Lnaguage" maybe? > Here is some info you may find useful too http://www.rondebruin.nl/windowsxpzip.htm |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
Tanks, i´ll try it
In this forum i found another Tip, in creating a Blank ZIP file with "PK" bytes and 17 bytes with CHR(0) I´ll try to see ============================================ Set Ag=Wscript.Arguments username = CreateObject("Wscript.Shell").Environment("Process ")("username") Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.OpenTextFile(FilePath&"_forms\workforus\_uploa ds\"&"form_data.zip", 2, vbtrue) BlankZip = "PK" & Chr(5) & Chr(6) For x = 0 to 17 BlankZip = BlankZip & Chr(0) Next ts.Write BlankZip set objFolder = nothing set objShell = nothing Set fso = nothing Set ts = nothing Set objShell = CreateObject("Shell.Application") Set WshShell = WScript.CreateObject("WScript.Shell") Set DestFldr=objShell.NameSpace(FilePath&"_forms\workf orus\_uploads\"&"form_data.zip") Set SrcFldr=objShell.NameSpace(FilePath&"_forms\workfo rus\_csv") DestFldr.CopyHere (FilePath&"_forms\workforus\_csv") ============================================ "LJB" wrote: > > "FB" <FB@discussions.microsoft.com> wrote in message > news:BA2EBF27-A76A-487C-8837-90D9D1BD8168@microsoft.com... > > Ho can i create Zip Files via command-line? > > Can be done via WMI? > > > > I don´t wann use WinZIP COmmand Line Add-On, because it is not freeware > > > > Can i use VBScript to do that? Other "Lnaguage" maybe? > > Since Windows already knows how to deal with zip files to some extent you > might want to try the following. No external programs are needed. Believe it > or not the wscript.sleep at the end is important to make this work > correctly. > > Const FOF_CREATEPROGRESSDLG = &H0& > > Const MyZip = "C:\..\MyZipFile.zip" > > Const File1 = "C:\..\File1.txt" > Const File2 = "C:\..\File2.txt" > > Const MyDest = "C:\scratch" > > '-------------- create empty zip file --------- > > 'Create the basis of a zip file. > CreateObject("Scripting.FileSystemObject") _ > .CreateTextFile(MyZip, True) _ > .Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar) > > > '-------------- zip --------------------------- > > 'get ready to add files to zip > With CreateObject("Shell.Application") > > 'add files > .NameSpace(MyZip).CopyHere File1, FOF_CREATEPROGRESSDLG > > .NameSpace(MyZip).CopyHere File2 > > End With > wScript.Sleep 1000 > > > |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
It works great for small files, for large files i´ve added a Wscript.Echo
(Modal Button, with OK) and ionly works if i click the OK button after the Zip proccess ( i can see a dialog box with a gauge indicating that the zipins in on the way Maybe it be necessary to use a higher number in the sleep directive "LJB" wrote: > > "LJB" <postmaster@[127.0.0.1]> wrote in message > news:Odh9kKG4IHA.1952@TK2MSFTNGP03.phx.gbl... > > > > "FB" <FB@discussions.microsoft.com> wrote in message > > news:BA2EBF27-A76A-487C-8837-90D9D1BD8168@microsoft.com... > >> Ho can i create Zip Files via command-line? > >> Can be done via WMI? > >> > >> I don´t wann use WinZIP COmmand Line Add-On, because it is not freeware > >> > >> Can i use VBScript to do that? Other "Lnaguage" maybe? > > > > Here is some info you may find useful too > http://www.rondebruin.nl/windowsxpzip.htm > > > |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
What´s the purpose of the Const MyDest = "C:\scratch"??? In any circunstances this line is used for something? "LJB" wrote: > > "LJB" <postmaster@[127.0.0.1]> wrote in message > news:Odh9kKG4IHA.1952@TK2MSFTNGP03.phx.gbl... > > > > "FB" <FB@discussions.microsoft.com> wrote in message > > news:BA2EBF27-A76A-487C-8837-90D9D1BD8168@microsoft.com... > >> Ho can i create Zip Files via command-line? > >> Can be done via WMI? > >> > >> I don´t wann use WinZIP COmmand Line Add-On, because it is not freeware > >> > >> Can i use VBScript to do that? Other "Lnaguage" maybe? > > > > Here is some info you may find useful too > http://www.rondebruin.nl/windowsxpzip.htm > > > |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
"FB" <FB@discussions.microsoft.com> wrote in message news:A90AC5DD-C39D-4328-BEFE-8F38912C9A48@microsoft.com... > > What´s the purpose of the Const MyDest = "C:\scratch"??? > In any circunstances this line is used for something? > > "LJB" wrote: > Const MyDest = "C:\scratch" was something I used and forgot to remove before sending the example. |
|
![]() |
| Outils de la discussion | |
|
|