Using 'xp_cmdshell' to run a DOS command script.
Posted on 2004-04-27
Is it possible to perform the following in a SQL script using the system stored procedure 'xp_cmdshell':
1- Run the following in a SQL script
EXEC master.dbo.xp_cmdshell " c:\test.cmd @variable1" (not sure about the syntax)
The variable '@variable1' iwould be defined in the SQL script, and actually contains the name of a text file and I want it passed to the DOS command script 'test.cmd' when 'xp_cmdshell executes.
2- The DOS command script should then open up the text file, manipulate its contents (ie add/remove characters) and finally save it in another text file. (Is this somthing that can be done using a DOS command script?).
Thank you for your help in advance.