开发者

Users have open files on BackupSharedFolder. Continuing the operation will force the files closed

I am using below sql statement to create shared folder with permission

EXEC xp_cmdshell 'net share BackupSharedFolder=D:\testshared /REMARK:"test shared"'

It is working fine with create shed folder.

then i will use below sql command to remove shared EXEC xp_cmdshell ' net share BackupSharedFolder /delete"'

Above is also working fine if shared folder is not opened.

if shared folder is opened.It giving error like following "Users have open files on BackupSharedFolder. Co开发者_开发知识库ntinuing the operation will force the files closed. Do you want to continue this operation? (Y/N) [N]: No valid response was provided."

and ask for prompt for Yes or NO.

So, how can i force sql command to yes and remove share by this XEC xp_cmdshell ' net share BackupSharedFolder /delete".


So, I am bending the SO rules a little: instead of answering your question, I have to advise that doing this seems like a really bad idea. Please don't control the OS through SQL Server's xp_cmdshell. It's just wrong on so many levels... architecture, security, design ...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜