2011-08-11 7 views
4

을 사용하여 저장 프로 시저 내에서 박쥐 파일 실행 xp_CMDShell을 사용하여 박쥐 파일을 실행하려고하면 인식 할 수없는 명령으로 메시지가 나타납니다.SQL Server 2005

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

다음과 같이 나는 메시지를 받았습니다 :

내가 실행 명령은 다음

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

제안. 저장 프로 시저 내에서 박쥐 파일을 실행하는 방법을 알려주십시오. SQl Server를 처음 사용합니다. 이중

감사합니다, Vinu

답변

5

, 당신이 따옴표를 사용하는 내부의 경로 ""

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

xp_cmdshell을가 긴 파일 이름에 약간 까다 롭고 될 수 있습니다 넣고 그 공을 재생되지 않는, 따옴표가 작동하는 경우도 있지만 공을 재생하고 싶지 않은 경우 이전 버전의 8.3 파일 이름을 사용하십시오. 매개 변수없이

exec master..xp_cmdshell 'c:\docume~1\adcxqcv\Desktop\PQA\sample.bat'