TimFCollins
asked on
How can I configure the xp_cmdshell command to execute a file through the command prompt including passing variables?
Hello,
I am trying to use the xp_cmdshell sp in SQL Server 2000 to execute an exe file that requires variables. I can get it to execute the file but it won't add the variables.
I am trying to call sendmail.exe. When in a command window I can type:
c:\sendmail.exe -t to@test.com -f from@test.com -s test -m 10.100.1.1
and that works fine. However, when I put it in a SQL Server stored procedure:
set @cmdtest = 'c:\sendmail.exe -t to@test.com -f from@test.com -s test -m 10.100.1.1'
exec xp_cmdshell @cmdtest
when i run this i get a result back that is the same as entering 'c:\sendmail.exe 'in a command window. How can I get SQL Server to recognize the rest of the string that I'm passing to xp_cmdshell?
Thanks in Advance,
Tim F.
I am trying to use the xp_cmdshell sp in SQL Server 2000 to execute an exe file that requires variables. I can get it to execute the file but it won't add the variables.
I am trying to call sendmail.exe. When in a command window I can type:
c:\sendmail.exe -t to@test.com -f from@test.com -s test -m 10.100.1.1
and that works fine. However, when I put it in a SQL Server stored procedure:
set @cmdtest = 'c:\sendmail.exe -t to@test.com -f from@test.com -s test -m 10.100.1.1'
exec xp_cmdshell @cmdtest
when i run this i get a result back that is the same as entering 'c:\sendmail.exe 'in a command window. How can I get SQL Server to recognize the rest of the string that I'm passing to xp_cmdshell?
Thanks in Advance,
Tim F.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks,
Tim F.