1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Support' started by rps, Nov 18, 2014.

  1. rps

    rps

    Joined:
    Jul 6, 2008
    Messages:
    194
    Likes Received:
    3
    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>
     
  2. gwgaston

    gwgaston Senior IT Security Consultant

    Joined:
    May 28, 2008
    Messages:
    41
    Likes Received:
    1
    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
     
  3. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,808
    Likes Received:
    82
    Fixed in build 54.

    Note that SET /P is intended solely for CMD compatibility, but your example will not work with CMD (because CMD will expand the variable before you enter it).
     
    gwgaston likes this.
  4. gwgaston

    gwgaston Senior IT Security Consultant

    Joined:
    May 28, 2008
    Messages:
    41
    Likes Received:
    1
    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.
     

Share This Page