How to assign the value of a variable in a batch file, trying this way.

set /p input = Enter int echo %input% IF "%input%" == 1 ( cd bh && mvn clean package) 

Issues command line

 C:\Users\s>set /p input = Enter chislo Enter int1 C:\Users\s>echo Режим вывода команд на экран (ECHO) включен. C:\Users\s>IF "" == 1 (cd bh && mvn clean package ) 

I tried to use a variable without quotes, the same result that I do not do right?

  • set / p input = Enter int space before "=" echo% input% IF% input% == 1 (echo ok) quotes - Tomas

1 answer 1

You have a space before the equal sign. As a result, the set command creates a variable named " input " (notice the space at the end).

  • yeah, it works, thanks - J Mas