Welcome to Scripting Forums Sign in | Join | Help
in Search

Trouble with Winzip CLI and parentheses in the file name

Last post 09-10-2008, 9:53 PM by AbqBill. 2 replies.
Sort Posts: Previous Next
  •  08-15-2008, 8:06 PM 29990

    Trouble with Winzip CLI and parentheses in the file name

    I cannot zip a file at the command line with a left paren in the file name. (

    Here is the output of the Winzip command:

    Attempting to compress "Copy of archive2007(1).pst"

    PST Zipfile name: Copy of archive2007(1_.pst
    Press any key to continue . . .
    WinZip(R) Command Line Support Add-On Version 2.3 (Build 8094)
    Copyright (c) WinZip International LLC 1991-2008 - All Rights Reserved


    Error: No files were found for this operation - Nothing to do. (C:\Users\USERBEINGBACKEDUP\Local Settings\Application Data\Microsoft\Outlook\Copy of archive2007(1_.pst.zip)
    Winzip Errorlevel: 12
    .pst.zip was unexpected at this time.
    C:\WINDOWS>

    and when you get a "was unexpected at this time." error your script dies. grr.

    I've use these commands to change the parens to underscores but only the right one gets replaced, using the same command:
    set PST_TO_ZIP_ZIPFILENAME=%PST_TO_ZIP:(=_%
    set PST_TO_ZIP_ZIPFILENAME=%PST_TO_ZIP:)=_%

    I have also tried these to no avail:
    set PST_TO_ZIP_ZIPFILENAME=%PST_TO_ZIP:^(=_%
    set PST_TO_ZIP_ZIPFILENAME=%PST_TO_ZIP:%(=_%
    set PST_TO_ZIP_ZIPFILENAME=%PST_TO_ZIP:%%(=_%

    Can anyone suggest a way to get the replacement command to work as I want it to?

  •  08-18-2008, 1:53 AM 29991 in reply to 29990

    Re: Trouble with Winzip CLI and parentheses in the file name

    Do you have some more info on the command you use, I have no problems at all archiving files wil either a single left "(", a single right ")"  or both parnes in a filename

    I am using WinZip 11.2 with the V2.3 commandline addon.

    Cheers, Hans

    PS. This is how I tested it.

    C:\Documents and Settings\User>dir /b *.pst
    Copy of archive2007(1).pst
    Copy of archive2007(1_.pst
    Copy of archive2007_1).pst

    C:\Documents and Settings\User>"c:\Program Files\WinZip\wzzip" pst.zip "C:\Documents and Settings\User\Copy of archive2007(1).pst"
    WinZip(R) Command Line Support Add-On Version 2.3 (Build 8094)

    updating Copy of archive2007(1).pst
    updating Zip file pst.zip

    C:\Documents and Settings\User>"c:\Program Files\WinZip\wzzip" pst.zip "C:\Documents and Settings\User\Copy of archive2007(1_.pst"
    WinZip(R) Command Line Support Add-On Version 2.3 (Build 8094)

    updating Copy of archive2007(1_.pst
    updating Zip file pst.zip

    C:\Documents and Settings\User>"c:\Program Files\WinZip\wzzip" pst.zip "C:\Documents and Settings\User\Copy of archive2007_1).pst"
    WinZip(R) Command Line Support Add-On Version 2.3 (Build 8094)

    updating Copy of archive2007_1).pst
    updating Zip file pst.zip

    C:\Documents and Settings\User>

    Also tried this without the full path spec, and also no problem there

  •  09-10-2008, 9:53 PM 30052 in reply to 29990

    Re: Trouble with Winzip CLI and parentheses in the file name

    Hi thelotus2006,

    ( and ) are special characters in Cmd.exe, so you must escape them with the ^ symbol; e.g.

    zip -9X mydocs^(1^).zip c:\data\*.doc

    ...or something similar.

    Bill

View as RSS news feed in XML
SPONSORED LINKS FEATURED LINKS

Download Data Protection Manager 2007Disaster recovery at a low cost Maximize speed, performance and reliablity of your PCs and servers—automatically!Speed Up Your PC! Try Diskeeper 2008 with InvisiTasking Free Now! Microsoft Learning Snack - Green IT Through Virtualization Many organizations face rising operating costs caused by excessive energy consumption. Virtualization and "Green IT" can help cut these costs. Get the information you need to bring Green IT savings to your business. Order Your Fundamentals CD Today!Register today for your in-depth copy of one of three Fundamental CDs on the following topics – Exchange, SQL, and SharePoint. Microsoft Learning Snack - Virtualization With Windows Server 2008Windows Server 2008 includes virtualization technology that allows many operating systems - including open source - to run on a single host. Come learn the basics of implementing these features. Microsoft Learning Snack - Virtualization BasicsWith virtualization, computing components essentially become on-demand services, freeing each element of a system from the others. This short video explains the needs, benefits, and technologies behind virtualization. Microsoft Learning Snack - Virtualization BasicsWith virtualization, computing components essentially become on-demand services, freeing each element of a system from the others. This short video explains the needs, benefits, and technologies behind virtualization. Microsoft Learning Snack - Virtualization With Windows Server 2008Windows Server 2008 includes virtualization technology that allows many operating systems - including open source - to run on a single host. Come learn the basics of implementing these features. Empower Your Processes with PowerShell 201Paul Robichaux delves deep into PowerShell how-tos in 3 informative lessons, each followed by live Q&A—all on your own computer! Register today! Microsoft Learning Snack - Green IT Through VirtualizationMany organizations face rising operating costs caused by excessive energy consumption. Virtualization and "Green IT" can help cut these costs. Get the information you need to bring Green IT savings to your business. New Release: Windows IT Pro Master CD13 years of content archives, fast answers with advanced search tools, and full access to WindowsITPro.com—order today!

 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing