How to silently delete files with a bat file
In jammykam's answer, he uses >nul 2>&1
. What this does is redirect both standard output and standard error to the null device. However, hiding the standard error is not best practise and should only be done if necessary.
@echo off
del /s *.jpg 1>nul
In this example, 1>nul
only hides the standard output, but standard error will still show. If del
fails to delete some files, you will be informed.
Read more about redirection
Turn echo off to suppress showing the command being run, and redirect output to null as @Sico suggested.
@echo off
del /s *.jpg >nul 2>&1
You should see nothing displayed when the bat file is run.