当我尝试使用xp_CMDShell执行bat文件时,我得到了一条消息as not recognized。
下面是我执行的命令:
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有什么建议吗。让我知道如何在存储过程中执行bat文件。我是SQl服务器的新手。
谢谢,维诺
发布于 2011-08-11 17:35:06
将路径放入"“
EXEC master..xp_CMDShell '"C:\Documents and Settings\adcxqcv\Desktop\PQA\sample.bat"' 发布于 2011-08-11 17:37:53
xp_cmdshell在长文件名上可能有点挑剔,你使用的是引号,它不是在玩球,双引号有时可以工作,但如果它仍然不想玩球,那么尝试使用旧的8.3文件名。
exec master..xp_cmdshell 'c:\docume~1\adcxqcv\Desktop\PQA\sample.bat' 发布于 2014-07-07 15:19:06
不带参数的
exec(' xp_cmdshell ''C:\script\test.bat'); --your bat file location(path)带有参数的
exec(' xp_cmdshell ''C:\script\test.bat '+@ecistate+' '+@stateid+' '+@pcno+''''); --your bat file location(path)执行并享受解决方案:)
https://stackoverflow.com/questions/7023625
复制相似问题