batch file that cleans desktop?
Posted: 13 Jun 2011 14:32
Hello, im trying to make an not rly common thing lol, i need to remove all the desktop icons and folders with the subfolders ofcourse in to a specific folder. i wanna do all this with a single silent batch file
here is what i came up with:
im sure my code is wrong, and also because the thing what happens, it does moves the files but it leaves all the empty folders on the desktop. i know that the RD command also trys to delete "desktop" folder with all the subfolders, but since desktop folder is busy and cant be deleted, then this whole thing just fails and none of the folders gets deleted. well i know that the RD now stands in fail, but i cant figure out anything better :/ please help and rewrite my commands in right way to get to the goal ;D
here is what i came up with:
Code: Select all
@echo off
xcopy /Y %userprofile%\Desktop\*.* %userprofile%\DesktopFiles\ /s /q /f
del %userprofile%\Desktop\*.* /s /q /f
ECHO Y | RD /s %userprofile%\Desktop\
im sure my code is wrong, and also because the thing what happens, it does moves the files but it leaves all the empty folders on the desktop. i know that the RD command also trys to delete "desktop" folder with all the subfolders, but since desktop folder is busy and cant be deleted, then this whole thing just fails and none of the folders gets deleted. well i know that the RD now stands in fail, but i cant figure out anything better :/ please help and rewrite my commands in right way to get to the goal ;D