Scenario
I want that If user enters a value, I get host name and If user do not enter any value then I just echo default path.
Problem Statement
After adding these conditions in if else I am getting echo is off if user enters a values.
How can i resolve this?
SET /P USER_INSTALL= Installation Path :
@echo:
if "%USER_INSTALL%"=="" ( echo "------Default path------") else (
ECHO %USER_INSTALL%
FOR /F "usebackq" %%i IN (`hostname`) DO SET HOST=%%i
ECHO %HOST%)
SET /P USER_INSTALL= Installation Path :
toSET /P "USER_INSTALL=Installation Path: "
see no spaces around equsl sign. also don't useecho:
to echo a blank line, use eitherecho/
orecho(
.:
serves the same as the/
or(
in an echo. The prompt in a set /p may have as much leading spaces as you like - they are ignored.