C:\_G\WWW\~ELISANET\INFO\tscmd017.html
<https://www.salminet.fi/info/tscmd017.html>
Copyright © 2003- by Prof. Timo Salmi  
Last modified Fri 12-Oct-2018 02:40:12

 
Assorted NT/2000/XP/.. CMD.EXE Script Tricks
From the html version of the tscmd.zip 1cmdfaq.txt file
To the Description and the Index
 

This page is edited from the 1cmdfaq.txt faq-file contained in my tscmd.zip command line interface (CLI) collection. That zipped file has much additional material, including a number of detached .cmd script files. It is recommended that you also get the zipped version as a companion.

Please see "The Description and the Index page" for the conditions of usage and other such information.



17} How can I avoid the potential "ECHO is off." in echoing %myvar%

Use a period right after the echo.
@echo off
setlocal
set myvar=This is a test
echo.%myvar%
set myvar=
echo.%myvar%
echo That's all
endlocal

Which gives
D:\TEST>cmdfaq
This is a test

That's all

Without the period (.) you'd get
D:\TEST>cmdfaq
This is a test
ECHO is off.
That's all

Of course, this always is valid
@echo off & setlocal enableextensions
set myvar=
echo myvar=%myvar%
set myvar=Hi there
echo myvar=%myvar%
endlocal & goto :EOF

C:\_D\TEST>cmdfaq
myvar=
myvar=Hi there

You might also find the information in the following items of interest: item #040, item #47, item #51, item #82, item #89, item #141.

[Previous] [Next]

C:\_G\WWW\~ELISANET\INFO\tscmd017.html
C:\_G\WWW\~ELISANET\FTPCMD\TSALMI.CMD /tscmd017
https://www.salminet.fi/info/tscmd017.html
file:///c:/_g/www/~elisanet/info/tscmd017.html