|
The following command runs perfectly from the command line, but I cannot get it to run using the KIX32 RUN command:
%COMSPEC% /C "FOR /F "tokens=*" %a in ('DIR /ogn /ad /b "%SYSTEMDRIVE%\Documents and Settings"') do (XCOPY /Q /Y "<SERVER LOCATION>\normal.dotm" "C:\Documents and Settings\%a\Application Data\Microsoft\Templates\") > nul 2> nul)"
The command will be used in a larger KIX script, and I want to call it using RUN rather than SHELL so that it doesn't delay the rest of the script. I would prefer not writing this single command to a seperate batch file. I am suspecting this is a quoting issue, but I really don't know.
My current attempts (failures) include the following:
RUN '%COMSPEC% /C "FOR /F "tokens=*" %a in ('DIR /ogn /ad /b "%SYSTEMDRIVE%\Documents and Settings"') do (XCOPY /Q /Y "<SERVER LOCATION>\normal.dotm" "C:\Documents and Settings\%a\Application Data\Microsoft\Templates\") > nul 2> nul)"'
RUN '%COMSPEC% /C "FOR /F "usebackq tokens=*" %a in (`DIR /ogn /ad /b "%SYSTEMDRIVE%\Documents and Settings"`) do (XCOPY /Q /Y "<SERVER LOCATION>\normal.dotm" "C:\Documents and Settings\%a\Application Data\Microsoft\Templates\") > nul 2> nul)"'
RUN '%COMSPEC% /C FOR /F "tokens=*" %a in ('DIR /ogn /ad /b "%SYSTEMDRIVE%\Documents and Settings"') do (XCOPY /Q /Y "<SERVER LOCATION>\normal.dotm" "C:\Documents and Settings\%a\Application Data\Microsoft\Templates\") > nul 2> nul)'
I've also tried the above commands with %%a replacing %a as the variables in the FOR statement, given that this may be considered to be a "batch" script.
Thanks in advance.
|