1

So, (a snippet of) my code is:

@echo off
set /p input=" "
if %input% == start_internal /DEV goto internal_dev
:internal_dev
::Some stuff here::

and every time I try it, it exists, and I am wondering how I can add the space in start_internal /DEV if at all possible. Thanks

P.S. It should work in Windows 10 too.

  • 4
    Use double quotes. `if /I "%input%"=="start_internal /DEV"`. The `/I` switch makes a case-insensitive comparison. – rojo Feb 26 '16 at 16:37
  • 1
    And read additionally [How to set environment variables with spaces?](http://stackoverflow.com/a/34402887/3074564) and [Why is no string output with 'echo %var%' after using 'set var = text' on command line?](http://stackoverflow.com/a/26388460/3074564) as you use the double quotes not right on lines with command __set__. – Mofi Feb 26 '16 at 17:25
  • Dear rojo, now when I do it, it is saying `goto was unexpected at this time`. What should I do? –  Feb 28 '16 at 00:47

1 Answers1

0

Easy, use quotes " text here... ". Heres the fixed code if your lazy xd.

set /p input=" "
if "%input%" == "start internal" :: do stuff
:: do stuff
Michael
  • 68
  • 2
  • 10