user3671588
user3671588

Reputation: 3

Trouble with spaces in batch

I have a question. I have

    set /p displaytext=Text to be displayed:
    echo "%displaytext%"
    pause

and if I input something with spaces it displays what i wrote in quotes. How to get rid of them?. Help! Thanks in advanced. Also if i write something in caps with/without spaces it closes. Basically I want it to display exactly what I type no madder what and without quotes.

Upvotes: 0

Views: 36

Answers (1)

Rahul
Rahul

Reputation: 77926

Try like below. Just remove the " from "%displaytext%"

@echo off
    set /p displaytext=Text to be displayed:
    echo %displaytext%
    pause

For your reference, see output below for test run

D:\>test.bat
Text to be displayed:hi there user3671588
hi there user3671588
Press any key to continue . . .

Upvotes: 1

Related Questions