Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9254311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:26:10+00:00 2026-06-18T11:26:10+00:00

There has been variants of this question asked for generations, but despite writing some

  • 0

There has been variants of this question asked for generations, but despite writing some quite complicated Windows scripts, I can’t seem to find out how to make them actually silent.

The following is an excerpt from one of my current scripts:

@ECHO OFF
SET scriptDirectory=%~dp0
COPY %scriptDirectory%test.bat %scriptDirectory%test2.bat
FOR /F %%f IN ('dir /B "%scriptDirectory%*.noext"') DO (
del "%scriptDirectory%%%f"
)
ECHO

The result of this is:

C:\Temp> test.bat
        1 file(s) copied.
File Not Found
Echo is off.

C:\Temp>

Whereas the “1 file(s) copied.” is just annoying, the “File Not Found” makes the user think that something has gone wrong (which it hasn’t – no files is fine).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:26:11+00:00Added an answer on June 18, 2026 at 11:26 am

    To suppress output, use redirection to NUL.

    There are two kinds of output that console commands use:

    • standard output, or stdout,

    • standard error, or stderr.

    Of the two, stdout is used more often, both by internal commands, like copy, and by console utilities, or external commands, like find and others, as well as by third-party console programs.

    >NUL suppresses the standard output and works fine e.g. for suppressing the 1 file(s) copied. message of the copy command. An alternative syntax is 1>NUL. So,

    COPY file1 file2 >NUL
    

    or

    COPY file1 file2 1>NUL
    

    or

    >NUL COPY file1 file2
    

    or

    1>NUL COPY file1 file2
    

    suppresses all of COPY‘s standard output.

    To suppress error messages, which are typically printed to stderr, use 2>NUL instead. So, to suppress a File Not Found message that DEL prints when, well, the specified file is not found, just add 2>NUL either at the beginning or at the end of the command line:

    DEL file 2>NUL
    

    or

    2>NUL DEL file
    

    Although sometimes it may be a better idea to actually verify whether the file exists before trying to delete it, like you are doing in your own solution. Note, however, that you don’t need to delete the files one by one, using a loop. You can use a single command to delete the lot:

    IF EXIST "%scriptDirectory%*.noext" DEL "%scriptDirectory%*.noext"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this has been asked a few times before, but there has been
I'm well aware that variants of this question have been asked before, but I
I know there has been quite a few posts on this but all the
I know that there has been one question about this but it is not
There has been similar questions asked (and answered), but never really together, and I
There was this problem that has been asked about implementing a load byte into
There has been a lot of questions about this... but somehow I can't get
I'am aware there has been a generic question about a best IDE in C++
Lately there has been a problem running some of our reports in access. Last
I know a lot of question regarding VB6 migration have been asked, but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.