How to start/open a file/folder that contains space in its name through command-line?

116,669

Solution 1

You would use:

start "" "c:\program files\"

That is because the first parameter is used as the title of the window, and is oddly enough, enclosed in double quotes.

Edit:

Here is a source about it: SS64

As an example, if you just type start "title" it opens a new cmd window with the title "title" in the title bar.

Solution 2

Type cd space and press Tab it will give you the directory items list, simple.

Solution 3

If you are already in the current directory, you could always do this.

C:\>cd "C:\Program Files"

C:\Program Files>start .

C:\Program Files>
Share:
116,669

Related videos on Youtube

amiregelz
Author by

amiregelz

Updated on September 18, 2022

Comments

  • amiregelz
    amiregelz over 1 year

    I'm trying to use the start command in the command prompt to open files and folders, but I'm unable to open files and folders that contain space(s) in their name.

    I have tried the following queries (testing on C:\Program Files):

    start C:\Program Files
    start C:/Program\ Files
    start C:/"Program Files"
    start C:\"Program Files"
    start "C:\Program Files"
    start "C:/Program Files"
    start C:/Program_Files
    start C:/Program%20Files
    

    But none of them work.

  • Cole Tobin
    Cole Tobin over 11 years
    What's with the empty one?
  • Bryan
    Bryan over 11 years
    +1; interesting, would love to know how this works?
  • nerdwaller
    nerdwaller over 11 years
    It's a title for the window, the parameter is enclosed in double quotes for some stupid reason. I rarely use Windows, especially when they do this stuff that makes little sense to me. In linux the CLI would be -t or whatever for title.
  • Bryan
    Bryan over 11 years
    Wow, trust who else but Microsoft to come up with something like that!
  • Karan
    Karan over 11 years
    A simple start /? would have clarified the params for the OP instead of struggling so much. As for "the parameter is enclosed in double quotes for some stupid reason", type start "Isn't it obvious?" cmd with and without quotes and see if you can figure out why the quotes might be required.
  • nerdwaller
    nerdwaller over 11 years
    Yes, it is obvious why quotations are needed. However, why that is not an optional parameter is not. That's the question.
  • Karan
    Karan over 11 years
    "the first parameter is used as the title of the window, and is oddly enough, enclosed in double quotes" and "the parameter is enclosed in double quotes for some stupid reason" implied you were talking about the quotes and were puzzled as to why they were required. As for why they didn't make the parameter optional, I doubt we'll ever know why but I totally agree that it wasn't a great idea. (BTW, if you don't use @, people are not informed of your comments.)
  • nerdwaller
    nerdwaller over 11 years
    Ah yes, I was unclear. And I know, but I assumed you would check back. Typically I do it, thanks!
  • Neerali Acharya
    Neerali Acharya almost 5 years
    And even explorer . will work