Winzip Problem with xp_cmdshell

  • When I run this command

    exec master..xp_cmdshell 'c:\program files\winzip\winzip32.exe –min –a –r -en c:\atlas\Users.zip c:\atlas\Users.txt'

    I got the error

    C:\Program' is not recognized as an internal or external command,

    operable program or batch file.

    Please help me how can I resolve this issue

  • I have not tried this, but I assume this should work:

    exec master..xp_cmdshell '"c:\program files\winzip\winzip32.exe" –min –a –r -en c:\atlas\Users.zip c:\atlas\Users.txt'

  • Another way is C:\Progra~1.  Problem is when passed to a command prompt it doesn't know what to do with spaces.  Chris's solution works as well because the " around the space is treated differently...



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • I have actually run across this in a production environment.  WinZip does not have a command line interface.  They have a separate product (for a small fee, of course) called WZZIP.  Here is the syntax for executing it, once you have it installed:

    exec xp_cmdshell 'C:\Progra~1\WinZip\wzzip.exe -a e:\backup\bkp01.zip e:\backup\bkp01.bak'

    This works very well, and we have been happy with it for more than a year.

  • This is probably the single thing that I hate most about MS: allowing spaces in file names and directories. I'd love to see a directory patch that would disallow this, but it would probably break the OS because so many of the MS and system directories have spaces in them!

    Having to either use quotes or remember the eight character "short cut" of a directory name is just a miserable pain in the arse.

    -----
    [font="Arial"]Knowledge is of two kinds. We know a subject ourselves or we know where we can find information upon it. --Samuel Johnson[/font]

  • You can force 8.3 (short) filenames, however, there are issues with it, as this blog points out:

    Aaron Stebner's Weblog: Registry key to force Windows to use short filenames

    K. Brian Kelley
    @kbriankelley

  • I'd never want to go back to 8.3, I remember those days all too vividly. I would just like to tweak the file system drivers to make spaces an invalid character for file names.

    Hmmmm. Sounds like something you could do if you had the source code available to an operating system. Boy, that would be convenient! You could modify kernal/driver programs to do things like this. I'm sure MS is moving in this direction in order to provide better tools and service to its customers. 🙂

    (no, I'm not a linux-head, but I do know how to use it)

    -----
    [font="Arial"]Knowledge is of two kinds. We know a subject ourselves or we know where we can find information upon it. --Samuel Johnson[/font]

  • This is exactly what I was looking for thank you!!

    This works perfectly inside a sql Task.

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply