一个批处理文件:当我尝试运行该如何运行xp_cmdshell的
exec master..xp_cmdshell 'C:\f\alert.bat'
我收到以下错误信息:
'C:\f\alert.bat' is not recognized as an internal or external command,
operable program or batch file.
我如何使用运行xp_cmdshell这个批处理文件?
编辑:上面的命令是逐字。我没有使用任何有空格的参数。
可能的重复http://stackoverflow.com/questions/3759331/escaping-command-parameters-passed-to-xp-cmdshell-to-dtexec – billinkc
@billinkc从我能看到的问题的答案说,使用DOS 8.3的命名约定,正如你所看到的,我已经在做。我看到有两个人对你的评论投了赞成票,虽然这让我相信也许我错过了一些非常明显的东西。如果是这样,请你指出一下吗? –
我的假设是,在编辑之前,'C:\ f \ alert.bat'是实际命令的存根。如果在我的xp_cmdshell调用中有空白,我可以重现您的错误消息。亲自查看一下'exec master..xp_cmdshell'C:\ f \ alert.bat''我可以改变C:\ f c:\ DoesNotExist,只要有空格,就会返回“not recognized”错误信息。对此的解决方案是使用8.3命名约定或双引号 - 这两个都在参考问题中进行了演示。 – billinkc