I need to write a DOS batch file which conceptually does this:
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
SET TARGET=c:\Temp\directory name with spaces\
FOR %%C IN (A B C D ) DO (
copy "Setups\%%C\Release\%%C%Setup.msi" "%%TARGET%\%%C"
echo Similar commands ...
)
Where, for instance,
Setups\A\Release\ASetup.msi would be copied to c:\temp\directory name with spaces\A\ASetup.msi
The problem I’m having is that the command processor parses this very counter-intuitively and doesn’t produce the expected (or even a useful) result.
Is this possible in a single command file?
(I can do it with an auxilliary batch file – but that seems inelegant)
call copy "Setups\%%C\Release\%%CSetup.msi" "%TARGET%\%%CSetup.msi"You had a stray percentage sign in
%%C%Setup.msiThen a double percentage in
%%TARGET%– you only need one.You were missing Setup.msi from the end of the destination filename.
Note: I used call as well, by habit, even though you don’t strictly need it in this example.