including multiword directory names in path specifications, environment variable settings, etc.

Posted on 2012-09-01
Last Modified: 2012-09-02
EE Community,

I have some scripts that need to obtain the value of the Environment Variable 'JAVA_HOME'.  The fact that the value of this variable on my machine includes "C:\Program Files" appears to cause problems for the scripts I'm trying to run.  So I see error messages with the complaint that the file location "C:\Program" cannot be found.  I've tried surrounding the value of 'JAVA_HOME' with quotation marks in the listing for this variable in the Windows Environment Variables, but this did not resolve the problem.  This seems like it must be an old, classic Windows system complication (having multiword names for important system directories like 'Program Files'), so I'm thinking there must be ways to deal with this problem that others have come up with.  If anyone here has any suggestions for this, please let me know.


Question by:aedolbey
    LVL 8

    Accepted Solution

    Read this before...

    try it.

    You can usually fix it by turning on delayed expansion and use variables with !var! instead of %var%

    What version of windows are you using?

    Could be escape sequences in your path command.

    Does you Set command produce the correct results?

    Recreate System variable to include quotes at that level not in your re-use of "java Home"

    Author Comment

    Sorry, I should've included some details about the system I'm using in my post with the question.  I'm running the scripts I was talking about on Win7 Enterprise.  My own preference would be to use Linux of some flavor, but OS choice is a decision of the company I work for.  In general, I use Cygwin as a substitute as much as I can.  For running the scripts I mentioned in the question I posted here, I use Cygwin first, then back off to a Win 7 cmd prompt if there were problems, just to be sure it's something with Cygwin causing the problem.  But I had the same problem with both options.

    Does the OS setting I describe here change the advice you offered?

    Author Closing Comment

    Recreated System variable to include quotes.  This was probably the problem from the start.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    Image capture and Deploy method is consist on two phases. In our first phase we capture the image of windows from the PC in which Windows and others softwares are already installed. In second phase we deploy the created image on new PC in which we…
    One of the features I've come to appreciate about Windows 7 and Windows Server 2008 R2 is the ability to pin applications to the task bar. As useful a feature as I've found this, it does have some quirks.  For example, have you ever tried pinning an…
    This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
    The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now