44

I have a path like this: Y:\xxx\dd sss\aaa\ccc

Y:\ is mapped to an FTP address. Now when I try to use start to open my folder I cannot. Command prompt makes mistake a and goes to Y:\xxx\dd folder!

I already tried to use %20 instead of a space, but that was also unsuccessful.

I am running this using a batch file from an Oracle form.

Amir
  • 577
  • Not exactly sure what you're trying to do. Maybe C:\Windows\explorer.exe /e,"Y:\xxx\dd sss\aaa\ccc". – martineau Jan 30 '11 at 13:39
  • You scan change to the folder and the drive at the same time at a cmd prompt with cd /D "Y:\xxx\dd sss\aaa\ccc". – martineau Jan 30 '11 at 13:54

4 Answers4

62

Use quotes like this:

start "" "Y:\foo bar\baz"

The start builtin command can be used to create new console windows, if you give it a console-based program (or nothing at all, in which case it starts the default cmd.exe shell).

If the first argument is quoted, start assumes it's the title for the new console window, so give it an empty title. The following argument will then be correctly interpreted as the command to run / file to open.

u1686_grawity
  • 452,512
  • 2
    thanks for the note about the empty quote! Now I finally understand why sometimes a console window opens instead of an Explorer window. :) – Synetech Feb 20 '11 at 05:59
8

Put it in quotation marks like so:

start "" "Y:\xxx\dd sss\aaa\ccc"
Pylsa
  • 31,004
3

You really only need to quote the actual space(s)

For instance:

start /wait C:\path\test" "spaced\setup.exe
Toto
  • 17,839
Russ H
  • 31
  • Welcome to Super User! Before answering an old question having an accepted answer (look for green ✓) as well as other answers ensure your answer adds something new or is otherwise helpful in relation to them. Here is a guide on [answer]. There is also a site [tour] and a [help]. – help-info.de Sep 16 '22 at 18:47
-4

Put the part with the spaces into quotation marks, eg.:

C:\path\"to something"\file

Your welcome.

Zenir
  • 21