Rar a folder using sql script

  • When i execute the below command, i get the below error:

    exec master..xp_cmdshell 'rar a -ep2 -m3 -t D:\CDR_FTP\Archive\20121216.rar D:\CDR_FTP\Archive\20121216\'

    'rar' is not recognized as an internal or external command,

    operable program or batch file.

    NULL

    Kindly help me to rectify this error.

    Thanks in advance.

  • When you use xp_cmdshell, the command runs in the context of the SQL Server service account. There are two things you could try: make sure that the folder that rar.exe is in is specified in the PATH environment variable, or specify the path explicitly in your command.

    John

  • Thanks for the reply when i tried with this command before the rar it is working.

    "C:\Program Files\WinRAR\WinRAR.exe"

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

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