del /s .jpg
deletes all .jpgs .. but the problem is: it shows, in cmd when executed =>
C:\blabla..\this.jpg is deleted..
I want to turn this off. Such that user will not know what is happening (i.e, what files are being deleted).
del /s .jpg
deletes all .jpgs .. but the problem is: it shows, in cmd when executed =>
C:\blabla..\this.jpg is deleted..
I want to turn this off. Such that user will not know what is happening (i.e, what files are being deleted).
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.
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.
Try putting this at the top of your batch script: @echo off