I have had plenty of problems when moving lines inside IF ELSE structure. Code below does not print echo %VALUE1%;%VALUE2:~0,2%;%VALUE3%;%VALUE4%;%VALUE5% to file. Instead of that values are printed to console and last character is dropped? What is the problem?
@echo off
setlocal enabledelayedexpansion
SET ENABLED_X=1
SET FILE=test.txt
SET VALUE1=23,5
SET VALUE2=34,1
SET VALUE3=0,45
SET VALUE4=3,33
SET VALUE5=3,5
IF /I %ENABLED_X%==0 (
echo %VALUE1%;%VALUE2%;%VALUE3%;%VALUE4%>>%FILE%
echo NOT ENABLED
) ELSE (
echo %VALUE1%;%VALUE2:~0,2%;%VALUE3%;%VALUE4%;%VALUE5%>>%FILE%
echo %VALUE1%;%VALUE2:~0,2%;%VALUE3%;%VALUE4%;%VALUE5%
echo ENABLED
)
Aucun commentaire:
Enregistrer un commentaire