Help with Batch script

0

I am trying to make a batch script to generate routes for some projects or folders, my code is as follows:

@echo off 
title Rutas de Proyectos
echo [1] Solatino ASP.NET y Angular
echo [2] Solatino Web con Angular
set/a a=1
set/a b=2

set/p opcion=Que proyecto:
if %opcion% equ a (
    goto :RutaSolnet
)
if %opcion% equ b (
    goto :RutasolAngular
  )

:RutaSolnet 
CD C:\Users\PC\documents\solatinotours\web\ 
:RutasolAngular
CD C:\Users\PC\documents\solatinoAngular\

The thing is that it does not matter if I put in "option" the value 1 or 2, it always returns the last route, in this case it calls RutasolAngular, and so it happens if I add more routes, it never returns the route that should. Could someone help me?

    
asked by CobriiMusic Sz 05.04.2018 в 20:17
source

1 answer

1

Hello, maybe it would work for you to put a GOTO End at the end of each directory change and at the end of the script put :End .

:RutaSolnet

CD C:\Users\PC\documents\solatinotours\web\
GOTO End

:RutasolAngular

CD C:\Users\PC\documents\solatinoAngular\
GOTO End

:End

Remember to add an additional blank line to the end of the script if it is going to end with :End

    
answered by 05.04.2018 / 20:35
source