Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to modify a shortcut to use a different CPU affinity, e.g.:

cmd /c "start /affinity 7 path\program"

It works fine, until path or program contains spaces.

Then, quotes surrounding path\program would be needed, nested inside the other quotes.

How can this be achieved?

share|improve this question
up vote 1 down vote accepted

You don’t need the root quotes in this case. Simply set the shortcut target to:

cmd /c start /affinity 7 "path\program"
share|improve this answer
    
I'm stupid :-/ thanks! – Tobias Kienzler Aug 12 '12 at 11:09

You should try to use backslashes as escape character :

cmd /c "start /affinity 7 \"path\program\""

Note that backslashes are only special if they are in front of a quote or a backslash

Update :
Officially, the solution above should work, but in practice it seems it doesn't.

I tried without the backslashes and, although it sounds strange, it works for me (Win XP).

cmd /c "start /affinity 7 "path\program""

share|improve this answer
    
that results in > "\"path\program\"" could not be found... – Tobias Kienzler Aug 23 '10 at 13:58
    
You're right, sorry... Did you try without the backslashes ? I just tried it and it works for me (on XP) : cmd /c "start /affinity 7 "path\program"" – Julien N Aug 23 '10 at 14:26
    
it does not really work as intended. All consecutive parts of string are just concatenated, may them be quoted or no ("a b"c becomes a bc as one argument), and if you'll add a space to "path\program", you'll see how it fails. – whitequark Aug 23 '10 at 15:37
    
unfortunately that doesn't work either - for shortcuts. When I use Start->Run... I don't seem to need any quotes at all. Weird. I'm using WinSever2k3. Using a second shortcut to be executed via start ignores the affinity setting, so I guess I have to add program to my path. But thanks for trying, I'll check it on my Win XP at home, too. – Tobias Kienzler Aug 24 '10 at 7:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .