Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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)

Thanks.

share|improve this question

2 Answers 2

up vote 13 down vote accepted

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
share|improve this answer

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

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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