Why is not my Menu working?

1

I'm creating a batch box to run a 1-line script that merges all text files into 1 only. But I do not understand why the routine is not working.

Setup

Batch

Code

@echooff:MenuEcho.Echo1-ComboMergerEcho.set/pop=Escolhaumaop‡Æo:GOTO:eofEcho.if/i"%op%" == "1"(

copy *.txt Combinados.txt

goto Menu

)
    
asked by anonymous 16.09.2017 / 06:27

1 answer

1

In the line where you have GOTO:eof you are telling the interpreter to exit the execution.

When checking, place a space after the variable that needs to be checked. Instead of "%op%" == "1"( put "%op%" == "1" ( .

Following code is working:

@echo off

:Menu

Echo.
Echo  1 - Combo Merger
Echo.

set /p op=Escolha uma op‡Æo: 

Echo.

if /i "%op%" == "1" (

copy *.txt Combinados.txt

goto Menu

)
    
16.09.2017 / 16:38