Search found 2 matches

by mooring
2023-Mar-08, 4:38 am
Forum: Windows CMD Shell
Topic: Is there any way to modify a variable twice in the same IF comparison?
Replies: 7
Views: 7268

Re: Is there any way to modify a variable twice in the same IF comparison?

here is the working copy using procedure call

Code: Select all

@echo off
set /a x=1
set test=hello
if %x% equ 1 (
    set test=
    call :setupText Hi
    call :setupText There, this works
)
echo %test%
goto :EOF
:setupText
set test=%test% %*
goto :EOF
by mooring
2023-Mar-06, 10:05 am
Forum: Windows CMD Shell
Topic: Is there any way to modify a variable twice in the same IF comparison?
Replies: 7
Views: 7268

Re: Is there any way to modify a variable twice in the same IF comparison?

read this book https://archive.org/details/windowsntshellsc0000hill/page/76/mode/1up?view=theater " Windows NT Shell Scripting " at page 76, you will get why before if command execute, all variables in conditioin and commands in parenthesis are substituted by their value, so the first set ...