Run a command line in SQL job-

I am running a command line in a SQL job,

rmdir /s \\vmpro_server\CDBURNER\PreviousDay

But the problem is, is that it ask "are you sure? (Y/N)" so what is happening is that the job just hangs and doesn't complete the command,

How do i get round this?

LVL 2
meteorelecAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tigin44Commented:
you can run a command prompt command with xp_cmdshell system stored procedure.
this command requires sysadmin priviligages... usage i.e.

set @str = 'rmdir /s \\vmpro_server\CDBURNER\PreviousDay'
exec master..xp_cmdshell @str


Regards

0
meteorelecAuthor Commented:
I'm getting this error message when i execute xp_cmdshell:

Msg 50001, Level 1, State 50001
xpsql.cpp: Error 1314 from CreateProcessAsUser on line 636

0
Louis01Commented:
To force quiet mode:
rmdir /Q /S \\vmpro_server\CDBURNER\PreviousDay
 
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tigin44Commented:
did you try to run the xp_cmdshell with the sysadmin privillages? Otherwise you will get the error.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.