1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

PATH with spaces in folder name

Discussion in 'Windows XP' started by anjanesh, 2008/12/15.

  1. 2008/12/15
    anjanesh

    anjanesh Inactive Thread Starter

    Joined:
    2006/04/06
    Messages:
    28
    Likes Received:
    0
    Hi

    I am having issues setting a local environment variable with spaces in it.

    But when I do shutdown.bat which requires JAVA_HOME, it shows :
    Code:
    C:\>shutdown.bat
    Files\Java\jdk1.6.0_05\bin ";" was unexpected at this time.
    It obviously broke after C:\Program.
    I tried giving 2 double quote, SET JAVA_HOME=" "C:\Program Files\Java\jdk1.6.0_05\bin" "; but neither did that work.

    Is there a way to set a value with spaces ?

    Thanks
     
  2. 2008/12/15
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    Code:
    SET JAVA_HOME= "C:\Program Files\Java\jdk1.6.0_05\bin ";
    I don't think the semi-colon is necessary and is the cause of the problem.
     

  3. to hide this advert.

  4. 2008/12/15
    anjanesh

    anjanesh Inactive Thread Starter

    Joined:
    2006/04/06
    Messages:
    28
    Likes Received:
    0
    Semi-colon is not the cause of the problem.
    I tried with SET JAVA_HOME= "C:\Program Files\Java\jdk1.6.0_05\bin " and still get
    F:\Tomcat\bin>shutdown.bat
    Files\Java\jdk1.6.0_05\bin" " was unexpected at this time.
     
  5. 2008/12/15
    ephemarial

    ephemarial Well-Known Member

    Joined:
    2002/02/26
    Messages:
    426
    Likes Received:
    27
    PeteC and anjanesh like this.
  6. 2008/12/15
    anjanesh

    anjanesh Inactive Thread Starter

    Joined:
    2006/04/06
    Messages:
    28
    Likes Received:
    0
    EDIT : You're right - the no quotes version works !
     
    Last edited: 2008/12/15
  7. 2008/12/15
    wildfire

    wildfire Getting Old

    Joined:
    2008/04/21
    Messages:
    4,649
    Likes Received:
    124
    For anyone facing a similar problem...

    For paths/filenames with spaces quotes are normally required however, the SET command is special and everything after the = is included.

    Code:
     "C:\Program Files "
    is not the same as

    Code:
    C:\Program Files
    The problem in this thread was a combination of the ; as pointed out by TonyT and the quotes as pointed out by ephemarial.

    Quodos to both but it's unlikely either would have worked without the other.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.