SQL Server Performance

xp_cmdshell

Discussion in 'SQL Server 2005 General Developer Questions' started by GopalMynam, Dec 16, 2009.

  1. GopalMynam New Member

    Hi,
    I have a batch file with three lines as given below:
    Echo off
    cd C: empIncomingFilesBOKDecrypted2009-11110209
    rar.exe a C: empIncomingFilesBOKArchiveDecrypted20092009-11110209.rar
    This file gets executed fine from command prompt.
    But it fails when executed from query analyzer. The code is:Declare @RtnValue int
    Exec
    @RtnValue = xp_cmdshell 'C: empIncomingFilesInputFilesArchive.bat'Select @RtnValue
    The reason is "rar.exe' is not recognized as an internal or external command,"The environment variable "PATH"
    is set with value "C:program FilesWinRAR"
    Any suggestions to make this work.
    Thanks,
    Gopal
  2. satya Moderator

    This is a Windows operating system problem, also it iwll be better if you can install WINRAR under that TEMP location to pickup the command.
  3. GeriReshef New Member

    The batch file is probably in the server.When you execute it from the terminal - the system searches rar.exe in your computer,and when you execute it using xp_cmdshell - the system searches it in the server.Is this the problem?

Share This Page