When running a bat file, I'd like to see the commands being executed but not anything rem'ed out.

The problem is that it seems to be all or nothing. When using "echo off" nothing shows except the results of the commands, like "2 files copied". But when not using echo off, everything, including lines rem'ed out, shows while it runs. This makes the screen cluttered and hard to read.

How can I set it to see both the command (copy this there, or whatever) and the results too but nothing rem'ed out?

(I don't want to install any software as a solution)



Regardless of the ECHO setting within a batch file, any line that starts with the @ character will not print out. To prevent the REM lines from being displayed, leave ECHO ON ad put @ in front of the REM lines so that they would be:

@REM This won't be echo'd
@REM even with ECHO ON

You can use :: as an alternative comment prefix; such lines are parsed as invalid labels and are never displayed.

  • If I could give 2 checkmarks I would check this answer too. Gave an up arrow instead. Thanks.
    – CChriss
    Jul 29 '11 at 2:05
  • Yes... but unlike REM you cannot put a :: line just before the ending of a parenthesized block of instructions. for ... do ( \\ anything \\ ::comment \\ ) is invalid. (`\` for EOLs)
    – Benoit
    Aug 1 '11 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.