10 Haziran 2020 Çarşamba

Windows Batch ECHO OFF

Giriş
Batch dosyaları otomatik olarak echo on olarak başlarlar. Bunun tarihsel bir sebebi var. Açıklaması şöyle
ECHO ON was chosen as the default setting when interpreting batch files to preserve backwards compatibility. In PC-DOS 1.0, COMMAND.COM displayed each command as it interpreted it, and this couldn’t be disabled. ECHO was added in PC/MS-DOS 2.0, with a dual purpose (displaying messages, and controlling the display of batch file commands); its default is ON so that the behaviour of batch files written for DOS 1.0 doesn’t change.
Dosyanın başına @echo off yazılır. Böylece komutların çıktısı ekranda görünmez.

@ karakterinden 1 veya daha fazla olması fark yaratmaz.

Örnek
Şöyle yaparız.
@@@@@@@@echo off
ping localhost
ping google
echo test string
Normalde şöyle yaparız.
@echo off
ping localhost
ping google
echo test string

Hiç yorum yok:

Yorum Gönder