I'm a novice. I read a tutorial about the if statement, which mentions that when there are multiple commands and multiple variables in an if statement, the commands and variables need to be guided by the goto statement! Otherwise, the if statement will only execute the first command and variable.
-------------------------------------------------The example is as follows:
@echo on
set /p num=Please enter the operation you want to be confident about:
if "%num%"=="1" (
set /p a=Please enter content:
set /p b=Please enter file name:
set /p c=Please enter the file name after copying:
goto a
:a
echo %a% >%b%.txt
goto b
:b
copy %b%.txt c:\%c%.txt
)
pause
set a=
set b=
set c=
set num=
-----------------------------------------------------------------
I just want to ask the master how this goto is called. Isn't it said that batch processing commands are executed one by one from top to bottom? If so, what is the meaning of these two goto statements? Without the goto statement, the generated txt file has no title and exists as .txt. That's the situation mentioned above. I don't understand programming very much. I hope those who know can inform me. Thank you here first:)
-------------------------------------------------The example is as follows:
@echo on
set /p num=Please enter the operation you want to be confident about:
if "%num%"=="1" (
set /p a=Please enter content:
set /p b=Please enter file name:
set /p c=Please enter the file name after copying:
goto a
:a
echo %a% >%b%.txt
goto b
:b
copy %b%.txt c:\%c%.txt
)
pause
set a=
set b=
set c=
set num=
-----------------------------------------------------------------
I just want to ask the master how this goto is called. Isn't it said that batch processing commands are executed one by one from top to bottom? If so, what is the meaning of these two goto statements? Without the goto statement, the generated txt file has no title and exists as .txt. That's the situation mentioned above. I don't understand programming very much. I hope those who know can inform me. Thank you here first:)


