Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This question already has an answer here:

I want to make a relative link in Windows 7 to a path that contains a space character.

Making a relative link without a space in the path works as follows (explained here):

%windir%\system32\cmd.exe /c start .\somepath\myfile.xlsx

But in my case I have a space in the path:

%windir%\system32\cmd.exe /c start .\some path\myfile.xlsx

I know that normally you have to wrap your path with double quotes when creating shortcuts. This works well when having absolute links.

But the following solutions do not work in my case:

%windir%\system32\cmd.exe /c start ".\some path\myfile.xlsx"

%windir%\system32\cmd.exe /c "start .\some path\myfile.xlsx"

I also tried to use other quotes quotes (´,') with the above combinations but I did not succeed.

Do you know what I am missing here?

share|improve this question

marked as duplicate by grawity, Dave M, Dave Rook, DragonLord, Renan Feb 22 '13 at 16:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
The real question – quoting the argument to start – was already answered in Can I use the "start" command with spaces in the path?. –  grawity Feb 22 '13 at 12:58

1 Answer 1

It looks like the previous answer was erroneous. Try this:

%windir%\system32\cmd.exe /c start \D<Relative path in double quotes> <Name of file>

So for you it would be like,

%windir%\system32\cmd.exe /c start \D"some path" myfile.xlsx

Hope this helps.

share|improve this answer
    
Thanks for your suggestions. When I use %windir%\system32\cmd.exe /c start "some path\myfile.xlsx"on my machine it only starts a new cmd.exe window and sets the "some path\myfile.xlsx" as a label for the cmd.exe window. I cannot (or better do not want ;) to have absolute pathes because I have to copy the directory tree to another computer with different drive letters and prefix and it should still work there. –  Severin Winkler Feb 22 '13 at 12:35

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