1.

Solve : Variable in script.?

Answer»

Win XP H  SP3

When the following script is run, WITHOUT a value being entered for %1, %a% is set to 'ECHO is off.' without the '  ' - how can I PREVENT this happening please?

CODE: [Select]echo off
cls

set a=%1

echo %a% > %temp%\length.txt
for %%a in (%temp%\length.txt) do set /a length=%%~za%-4


echo %length%
TYPE %temp%\length.txt

 
Quote

echo off
cls

set a=%1

echo.%a% > %temp%\length.txt
for %%a in (%temp%\length.txt) do set /a length=%%~za%-4


echo %length%
type %temp%\length.txt
Thank you for the very speedy solution.

W.


Discussion

No Comment Found