Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Fixed Win "set /p" not working in V17 build 53

  • Thread starter Thread starter rps
  • Start date Start date
Jul
442
6
Set /p isn't working in V17.00.53 x64

Code:
D:\bat>set /p choice="Enter your choice: " & echo choice === %choice%
^C

D:\bat>ver

TCC  17.00.53 x64   Windows 7 [Version 6.1.7601]


D:\bat>set /p choice="Enter your choice: " & echo choice === %choice%
^C

D:\bat>

Works in V16.03.55 x64
Code:
C:\JPSoft\tcmd16x64>ver

TCC  16.03.55 x64   Windows 7 [Version 6.1.7601]


C:\JPSoft\tcmd16x64>set /p choice="Enter your choice: " & echo choice === %choice%
"Enter your choice: "3
choice === 3


C:\JPSoft\tcmd16x64>
 
Confirmed here too... although it doesn't hang, but returns a double usage error message:

Code:
Usage : SET [/A /D /E /O /P /R file... /RO /S /U /V /X] [name[=][value ]]
Usage : SET [/A /D /E /O /P /R file... /RO /S /U /V /X] [name[=][value ]]

ref Help:

Definition mode:


SET [/A /D /O /S /U /V /E /RO /R [file...] | name=value | prompt ]

prompt Optional input prompt for the /P name= option.

Looks like if you remove the spaces in the prompt set 'prompts' for input, but still doesn't set the variable. If you remove the prompt entirely it works:

Code:
unset choice

set /p choice=Enteryourchoice: & echo choice === choice%
fred
choice ===

set /p choice= & echo choice === %choice%
gtrf
choice === gtrf
 
Thanks Rex. I'm sure the OP (rps) appreciates your speedy work as well :) . I noticed the 'CMD expanding variable before set on same cmdline' thing and meant to mention it too, but of course that's only an issue with the echo output. The real issue was with the 'set /p' part which does work as written with CMD... I'm guessing rps made the example as a quick one liner for demonstration purposes only under TCC.
 
Back
Top
[FOX] Ultimate Translator
Translate