I am getting file not found on xp_cmdshell dir on local directory

扶醉桌前 提交于 2020-06-02 07:08:27

问题


Here is what I am trying to execute:

exec xp_cmdshell 'dir "D:\Data\GS Products" /AD /S /B'

This works with every other folder on data that I have tried but not with the one I am trying to use. I am logged in with the admin god privs, I have done the sp_configure to enable cmdshell and I have used this with other folders that have spaces in the name. Is it permissions? And if so, how can I check that? When I look at the properties of the folder it says the admin account has FULL permissions. Any help would be greatly appreciated.


回答1:


Well, didnt get much help this time, but maybe I did it wrong..anyway, I had to add the SQL Service account pemissions to the folder I was doing the command on. Even though I was logged in with the top admin login, it did not work until I added the permissions to the folder/subfolders.




回答2:


Right click folder you are importing from and click Properties, go to Security tab click Edit.

Add "Everyone".

Apply and OK.

See image for all details:

Your:

exec xp_cmdshell 'dir "D:\Data\ImportFolder" /AD /S /B'

will work now.

Note: xp_cmdshell needs only read permissions so you don't have to put full. I needed full because script I have need to write log file on the end in same folder.



来源:https://stackoverflow.com/questions/42520070/i-am-getting-file-not-found-on-xp-cmdshell-dir-on-local-directory

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!