Why is my menu not working?

Asked

Viewed 51 times

2

I’m creating a Batch menuzinho to run a 1-line script that merges all text files into 1 only. But I don’t understand why the routine isn’t working.

Setup

inserir a descrição da imagem aqui

Batch

inserir a descrição da imagem aqui

Code

@echo off

:Menu

Echo.
Echo  1 - Combo Merger
Echo.

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

GOTO:eof

Echo.

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

copy *.txt Combinados.txt

goto Menu

)

1 answer

2


On the line where GOTO:eof you are ordering the interpreter out of execution.

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

Still working code:

@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

)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.