xp_cmdshell to zip files?

  • I have pkzip on my server and would like to find out if it is possible to use xp_cmdshell to zip files.

    I've tried to test this by

    1)creating a text file called test.txt

    2)calling pkzip using xp_cmdshell through Query Analyzer as follows:

    exec xp_cmdshell 'pkzipc -add c:\test.zip c:\test.txt'

    I got the following message after running this:

    'pkzipc' is not recognized as an internal or external command, operable program, or batch file. NULL

    Has anyone tried anything like this before? Am I doing something wrong?

    I'd appreciate any feedback =)

    Thanks!

  • exec xp_cmdshell 'c:\pkzipc -add c:\test.zip c:\test.txt' and place pkzipc in c:\ or try place in sql binn directory.

  • Type the complete path name to the exe. I think somethjng like:

    exec xp_cmdshell 'c:\program files\pkzip.pkzipc -add c:\test.zip c:\test.txt'

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples

    Gregory A. Larsen, MVP

  • Thanks for your speedy responses! I used the full path to the .exe and that worked... =)

Viewing 4 posts - 1 through 3 (of 3 total)

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