28

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.

amiregelz
  • 8,297

5 Answers5

28

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.

nerdwaller
  • 18,014
14

Do you specifically need to use start?

You can use explorer "c:\program files" to give you the effect you are looking for.

1

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>
dmcgill50
  • 1,152
1

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

-1

Use url encoding

// assign base path initially from a filename

var basePath = Path.GetDirectoryName(doc.Filename);

this.BaseUri = new Uri($"file:///{basePath}"); // add file:/// prefix