How to trap an arror when using Winzip command line in batch files 
Author Message
 How to trap an arror when using Winzip command line in batch files

I am trying to use command line for Winzip in Batch files for the
first time.
i have used the following command:
winzip32 -a -r -p filename.zip files

i would be very gratefull if someone tell me how to trap an error if
found within my batch file.

something along this line will do.

if no error go to exit
echo ***error been detected***

:exit
echo ***zipped file created***

Thanks for your help in advance

Djelloul Guenaoui



Sun, 07 Aug 2005 01:03:48 GMT  
 How to trap an arror when using Winzip command line in batch files

Quote:

> I am trying to use command line for Winzip in Batch files for the
> first time.
> i have used the following command:
> winzip32 -a -r -p filename.zip files

> i would be very gratefull if someone tell me how to trap an error if
> found within my batch file.

> something along this line will do.

> if no error go to exit
> echo ***error been detected***

> :exit
> echo ***zipped file created***

Hi

It doesn't look like winzip32 (at least 8.0) delivers any other errorlevel than
0, whether error or success.

Set oShell = CreateObject("WScript.Shell")

iRC = oShell.Run("winzip32 -a -r -p c:\5\filename.zip C:\3\*.*", 1, True)

WScript.Echo iRC

Running the script above, iRC always returned 0, even if I provoked an "error"
situation for winzip32.

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and a ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Sun, 07 Aug 2005 01:30:11 GMT  
 How to trap an arror when using Winzip command line in batch files

Quote:

> I am trying to use command line for Winzip in Batch files for the
> first time.
> i have used the following command:
> winzip32 -a -r -p filename.zip files

> i would be very gratefull if someone tell me how to trap an error if
> found within my batch file.

> something along this line will do.

> if no error go to exit
> echo ***error been detected***

> :exit
> echo ***zipped file created***

Hi

On way of doing it is to delete any existing zip file before running winzip32,
and after it has run, test if the zip file exists (using the WSH
FileSystemObject)

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and a ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Sun, 07 Aug 2005 01:32:09 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to print word document from command line / batch file

2. Shelling to a Batch file with 2 command line arguments

3. Close or control any windows app from command line or batch file by calling WinAPI

4. Running a batch file using Shell command

5. create a file type for a virtual directory in IIS using a command line script

6. Bad Command or File name when Shelling DOS Batch File

7. how do I trap command line parameters for a vb exe

8. Passing values into and out of Command Line application *and* command line prompt in vbscript

9. Scripting command line applications & Command Line Prompting

10. Command-Line arguments using Command()

11. Transact SQL Batch command using SQLDMO

12. Help with Win 95 screen saver command line - command line.zip [1/1]

 

 
Powered by phpBB® Forum Software