Search code examples
dosxcopy

Using xcopy in a batch file with %programfiles%


I'm trying to use a batch file to help setup a build project. As part of that process I need to copy a lot of files from a temporary directory: %temp%\wcu to a new directory in the %programfiles% directory.

I am using the following command:

xcopy %temp%\wcu\dotnetframework\*.* %programfiles%\"Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\DotNetFx35SP1" /S

Of course the problem is that %programfiles% equates to "C:\Program Files" with a space and so xcopy throws a wobbly.

Any ideas on how to get around this?


Solution

  • use quotes

    xcopy "%temp%\wcu\dotnetframework\*.*" "%programfiles%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\DotNetFx35SP1" /S