Discussion Locked

How can I improve these batch files?

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have 2 batch files in my Autoexec.bat file to clean-up TEMP & Recent files at Boot-up.
@ECHO OFF
SET TMP=C:\WINDOWS\TEMP
SET TEMP=C:\WINDOWS\TEMP
IF EXIST C:\WINDOWS\TEMP\*.* DELTREE /Y C:\WINDOWS\TEMP\*.*
SET RECENT=C:\WINDOWS\RecentIF EXIST C:\WINDOWS\Recent\*.* DELTREE /Y C:\WINDOWS\Recent\*.*
Both files work great, but is there a way to hide what the batch files are deleting? In trying to hide my work, I now can see all of these deletions during boot-up. Also, is there a good website to learn more batch files?

6 replies

by rogerndgreen

You can always re-direct the output to the NUL device

eg IF EXIST C:\WINDOWS\TEMP\*.* DELTREE /Y C:\WINDOWS\TEMP\*.* >NUL

Or, if you have a whole section you don't want on screen, start the section with the line
CTTY NUL
and then end it with
CTTY CON

e.g.
CTTY NUL
echo "this bit won't display on screen"
CTTY CON
echo "this bit will display on screen"

As for a website, try starting at http://www.computing.net/

HTH
Roger

by Member 32401828

Thanks, I used the >NUL after the execute lines and it worked. I tried the web site, but didn't find much on batch files.

This discussion is closed to new replies.