" quotes to appear in t-sql

" quotes to appear in t-sql

 

  

I am trying to shell out to dos and execute a simple ftp command, the
problem is, when I run this statement through dos it works fine, when I
try to execute through a job, or t-sql I am getting an error

"C:\Program Files\WS_FTP Pro\wsftppro.exe" -s "Shared Sites!User
Sites!MYFTPSERVER:/e:/e:/backup_mp" -d "local:F:\prod_backups\"



Here is my code



SET NOCOUNT ON



declare @DOSCommand varchar(150)

set @DOSCommand = '"C:\Program Files\WS_FTP Pro\wsftppro.exe" -s "Shared
Sites!User Sites!MYFTPSERVER:/e:/e:/backup_mp" -d
"local:F:\prod_backups\"'

print @DOSCommand

exec master..xp_cmdshell @DOSCommand





I have a feeling it has something to do with the "s



Because the results showing in QA are as follows





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

operable program or batch file.

NULL



There should be a double quote in front of the C:\ not a single



Any help would greatly be appreciated


MS Sql Server LazyDBA home page