Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Executing a bat file inside a Stored Procedure using SQL server 2005

Tags:

sql-server

When i try to execute a bat file using xp_CMDShell, i am getting a message as not recognized command.

Following is the command i executed:

EXEC master..xp_CMDShell 'C:\Documents and Settings\adcxqcv\Desktop\PQA\sample.bat' 

I got a message as follows:

'C:\Documents' is not recognized as an internal or external command,
operable program or batch file.
NULL

Any Suggestions. Let me know how to execute a bat file inside a Stored Procedure. I am new to SQl Server.

Thanks, Vinu

like image 480
Vinodhini Avatar asked Aug 11 '11 09:08

Vinodhini


1 Answers

Put the path inside ""

EXEC master..xp_CMDShell '"C:\Documents and Settings\adcxqcv\Desktop\PQA\sample.bat"' 
like image 196
Tareq Avatar answered Nov 05 '22 23:11

Tareq