Saumil
Saumil

Reputation: 2517

set /p command is not working

Well suddenly my set /p command doesn't seem to be responding. I have written

@echo off
set /p pass=
echo %pass%
pause

When I execute the above code the console displays, ECHO is OFF without taking any input from the user. I have recently used SETLOCAL ENABLEDELAYEDEXPANSION in some other program so has it anything to do with it

Upvotes: 2

Views: 3175

Answers (1)

Ofir Luzon
Ofir Luzon

Reputation: 10908

I've copy pasted your code and it is working for me (with and without set ENABLEDELAYEDEXPANSION). You did not indicate which version of windows you use. try to change the set line to:

set /p pass=""

or to:

set /p pass="Enter your password:"

If it still not working for you, check if you can set the variable from a text file:

set /p pass=<filename.txt 

Upvotes: 2

Related Questions