1

I'm using the Linux subsystem under Windows 10.

If I have, for example, a PowerPoint file called x.pptx, I can request the Linux bash shell to request Windows to open the file with the default application. The following command will do the trick:

/mnt/c/Windows/System32/cmd.exe /C start x.pptx

But if the file name contains a space (for example, x y.pptx) I can't get it to work. I think I have tried every possible combination of single quotes, double quotes and backslashes.

Is what I want to do even possible?

EDIT

Here are my attempts:

Using x\ y.pptx or "x y.pptx" or 'x y.pptx' or \"x y.pptx\" simply causes the CMD window to open.

Using '"x y.pptx"' causes Windows to say that it cannot find y.pptx\ (the missing x and the backslash are not typos).

Using '\"x y.pptx\"' causes Windows to say that it cannot find y.pptx\\\ (sic).

3
  • have you tried with absolute path? is x y...in current working directory? start has also /D option to specify directory Commented Mar 12, 2018 at 8:57
  • @NahuelFouilleul, yes I have tried with the absolute path. Yes, x y.pptx is in the current working directory. Adding the /D option doesn't seem to help.
    – oz1cz
    Commented Mar 12, 2018 at 9:04
  • trying various start commands in cmd shows the same result using title seems to be a workaround Commented Mar 12, 2018 at 9:05

1 Answer 1

1

it seems the reason comes from start command:

from start /?, it seems the first quoted string is used as title, giving a title seems to be a workaround

start "title" "x y.pptx"

and launching from bash

/mnt/c/Windows/System32/cmd.exe /C start '"title"' 'x y.pptx'
3
  • It doesn't work for me. I just get a CMD window with a title of "x y.pptx". (The start "title" "x y.pptx" works nicely when executed directly in CMD, but I can't get it to work from bash.)
    – oz1cz
    Commented Mar 12, 2018 at 9:09
  • because bash quoting, updating answer Commented Mar 12, 2018 at 9:10
  • Nahuel, your edit doesn't work, but this does: /mnt/c/Windows/System32/cmd.exe /C start '"title"' 'x y.pptx'.
    – oz1cz
    Commented Mar 12, 2018 at 9:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.