remove space in directory name

Posted on 2005-05-14
Last Modified: 2010-04-13
i have a script(deploy.cmd) in dos windows XP; the dir path has a space

C:\Program Files\WebSphere\AppServer\java

and the script breaks after it sees the space

how can I escape the space so it takes it as a whole name
Question by:royalcyber
    LVL 10

    Expert Comment

    Try this
    Or this
    "C:\Program Files\WebSphere\AppServer\java"
    LVL 12

    Expert Comment

    Longbow is right,

    I will add in one more tidbit:

     The Progra~1 is the MSDOS "short name"

      If you need to know what it is for a given directory open a cmd prompt and do dir /x
      This will help you if you have a few similar long names as it might not be clear how to truncate them.

    - Jack
    LVL 7

    Expert Comment

    Don't truncate - always quote. Truncation is a deprecated feature which won't be around for much longer. Quoting is here to stay.
    LVL 12

    Accepted Solution

    PS on an unrelated subject -

      If you ever need to send a link in outlook that contains a space, you can do so by starting with a < and ending with a >

      Outlook will automatically convert to a link and remove the < and >

       Dear fred,
          the file you need is already on your computer.
         you can find it here: <c:\program files\freds program\fred.exe>

      - royalcyber


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    DECT technology has become a popular standard for wireless voice communication. DECT devices are not likely to be affected by other electronic devices and signals because they operate in a separate frequency-band.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    737 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

    22 Experts available now in Live!

    Get 1:1 Help Now