Zipping a txt file

Former Member
Former Member $organization

Hi

I'm trying to zip a Text file in SQL but once I run the command, sql keeps executing for long time and I don't get any error.

EXEC master..xp_cmdshell 'T:\Source\WinZip\winzip32.exe T:\Source\sso_pacingdata.zip T:\Source\sso_pacingdata.txt'

I also tried,

EXEC master..xp_cmdshell 'T:\source\WinZip\winzip32.exe -o T:\Source\sso_pacingdata.txt'

Probably my syntax is wrong. Can anyone please let me know the right syntax to Zip a Text file.

Thanks

Varsha

Parents
  • Hi Varsha,

    one more thing.

    the space in the line may caused the problem.

     

    declare @cmd varchar(1000)

    set @cmd='"T:\Source\WinZip\winzip32.exe" -o "T:\Source\sso_pacingdata.zip" "T:\Source\sso_pacingdata.txt"'

    EXEC master..xp_cmdshell @cmd

     

    You can use double quotation mark.

     

    have fun

    Ben

     

     

     

Reply
  • Hi Varsha,

    one more thing.

    the space in the line may caused the problem.

     

    declare @cmd varchar(1000)

    set @cmd='"T:\Source\WinZip\winzip32.exe" -o "T:\Source\sso_pacingdata.zip" "T:\Source\sso_pacingdata.txt"'

    EXEC master..xp_cmdshell @cmd

     

    You can use double quotation mark.

     

    have fun

    Ben

     

     

     

Children
No Data