This is really a follow up to the original question with this title but I am too noob to be allowed to comment there (can you merge this in as a comment Mike ?)
I just spent around a day trying to work out why I was getting this problem when I cut and pasted the command line verbatim from VS 2010 into a batch file and tried to run it.
I put the full path to link.exe in an env var in the batch file called "link" and ran the command as:
"%link%" /VERBOSE ... yada yada yada
and got the error “LNK1104: cannot open file 'C:\Program.obj'”.
This is because %link% is used by VS 2010 link.exe as additional input for linking.
As my %link% var was the program FQN "C:\Program Files\Micro$ Visual Studio 10.0..." (i.e. contains spaces), the linker tried to include "C:\Program" (as the first space delimited string), and added a suffix of ".obj" because it assumed that is what I meant.
It then tried to include this spurious file as an input, failed to find it, and fell over.
Being more of a gcc man myself, this behaviour was unexpected to say the least.
The trivial solution was to use a different name for my command variable - eg %lcmd%