O
O
other_letter2015-10-28 18:13:09
System administration
other_letter, 2015-10-28 18:13:09

I'm trying to clean up a folder on a schedule. What's wrong?

It is necessary to clean all the contents - both files and folders. Therefore del all the same does not roll.
I did this:
pushd "d:\folder" && (rmdir /s /q "d:\folder" & popd) 2>nul
and it works.
BUT! Only if you drive it into cmd manually. From the clean.cmd file - no way.
It is launched by the standard schedule on behalf of the administrator. Win Server 2000
===
Let's go the other way? What other ways are there to clean a folder on a schedule?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
other_letter, 2015-10-29
@other_letter

In short... it works like this. And without dancing with tambourines.

@echo off
1>nul chcp 1251
2>nul pushd "d:\folder" && rmdir /s /q "d:\folder\"
popd

All garbage, apparently, because of the encoding and the solution in the first line

A
Alexey S., 2015-10-28
@Winsik

1) If the folders with Russian letters did not confuse the batch file encoding?
2) did you check the box to run with the highest rights? (but most likely you shouldn't)
bdede154419f41339381aea02357008e.PNG

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question