Page 1 of 1

How to pass Yes automatically in a batch script?

Posted: 10 Dec 2018 11:19
by lalat06bag
Hi,

I have this piece of code.

SET "NASS=\\abc"
SET "TEMPDIR=%NASS%\CU\OR"
PUSHD "%TEMPDIR%"
forfiles /s /m *.* /c "cmd /c Del @path" /d -90
POPD

While executing, it asks \\abc\CU\OR\*, Are you sure (Y/N) ? and the job stops there till the input is provided.

Now how to pass Y in the above code?

Re: How to pass Yes automatically in a batch script?

Posted: 10 Dec 2018 11:34
by aGerman
That's a typical XY question. You don't need to pass Yes but you have to pass /Q as the help for DEL states.

Steffen

Re: How to pass Yes automatically in a batch script?

Posted: 10 Dec 2018 11:41
by Squashman
The FORFILES command is grabbing files and folders. When the script tries to delete a folder it will prompt you with that. It will not prompt to delete files.

Re: How to pass Yes automatically in a batch script?

Posted: 10 Dec 2018 13:55
by lalat06bag
correct. Thank you. now i made that silent by passing /Q.