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?
 
Louis01Connect With a Mentor Commented:
To force quiet mode:
rmdir /Q /S \\vmpro_server\CDBURNER\PreviousDay
 
0
 
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
 
tigin44Commented:
did you try to run the xp_cmdshell with the sysadmin privillages? Otherwise you will get the error.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.