Search code examples
windowsbatch-filecmd

Use batch file timeout without echoing command?


I'm fairly new to batch scripting but reasonably competent with programming in general. I'm currently calling a perl script from a batch file and am displaying the result from the perl script in the Windows command window for 10 seconds before exiting the command window.

I'm using the command

timeout /t 10 /nobreak

which is then also printed to the command window after the result of the perl script.

Is there any way to prevent this so that I just see the result of the perl script and then see the timer counting down?

I understand I can append '> NUL' to my timeout command to suppress the countdown timer but this isn't what I want to do. I just want to prevent what I see as a line of code printing to the command window. If this can't be done, it's no problem, I'll live with it. But if I can remove it I'd like to.

Thanks in advance for any help!


Solution

  • If you want to avoid echoing one command, prefix it with @:

    @timeout /t 10 /nobreak
    

    You can disable echoing at all with command

    echo off
    

    Normally, you put

    @echo off
    

    at beginning of batch file, so commands are not outputed.