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

variable programfiles(x86) loses space

Discussion in 'Support' started by hlhelman, Jan 8, 2011.

  1. hlhelman

    Joined:
    Mar 20, 2009
    Messages:
    32
    Likes Received:
    0
    Although set shows 2 spaces in the variable programfiles(x86) when I go to use it the second space disappears making the variable not very useful:

    C:\>set programfile*
    ProgramFiles=C:\Program Files
    ProgramFiles(x86)=C:\Program Files (x86)

    C:\>echo --"%programfiles"-- --"%programfiles(x86)"--
    --"C:\Program Files"-- --"C:\Program Files(x86)"--

    C:\>

    Oops, I'm sorry I see this has been addressed before.
    I used %@sharefolder[38] to work around this seven characters shorter than %[ProgramFiles(x86)]
     
  2. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,949
    Likes Received:
    30
    On Sat, 08 Jan 2011 17:47:16 -0500, hlhelman <> wrote:

    |C:\>set programfile*
    |ProgramFiles=C:\Program Files
    |ProgramFiles(x86)=C:\Program Files (x86)
    |
    |C:\>echo --"%programfiles"-- --"%programfiles(86)"--
    |--"C:\Program Files"-- --"C:\Program Files(86)"--

    You didn't ask for the right thing in the second case. Didn't you want
    "%programfiles(x86)"?

    Anyway, even that would have failed:

    Code:
    v:\> set
    ProgramFiles(x86)=C:\Program Files (x86)
    
    v:\> echo %programfiles(x86)
    C:\Program Files(x86)
    The sapce wasn't removed. What happened was that %programfiles was echoed
    subsequently followed by the literal) "(x86)". That's one way to interpret
    "%programfiles(x86)". And it's understandable; how's TCC to know where the
    variable name ends?

    Get around it like this, by telling TCC exactly what the variable name is:

    Code:
    v:\> echo %[programfiles(x86)]
    C:\Program Files (x86)
     

Share This Page