Copy Office XML Colour Palette to new PC using script

My company has recently re-branded and I have created new PowerPoint, Excel and Word templates.
In Office I have created my colour palettes which are very useful, but these dont go across with the PowerPoint/Excel/Word files.

Ive been looking into it and it create an XML file on the machine with all the colours within that palette.
C:\Users\user\AppData\Roaming\Microsoft\Templates\Document Themes\Theme Colors\Name.xml

I would like an easy way for everyone else in the company to copy this XML onto their computer.

Can this be done with a batch script??

Any advice?

Steve TinsleyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewIT / Software Engineering ConsultantCommented:
Well if you placed the file on a shared folder that everyone has access to, then a small BAT file like this could also be placed in that folder that they could run to copy the file to their machine.  Assuming you don't want to overwrite it if they already had that file, then perhaps something like:

@echo off
set SourceFile=\\server\share\folder1\Name.xml
set DestFile=%APPDATA%\Microsoft\Templates\Document Themes\Theme Colors\Name.xml
if not exist "%DestFile% copy "%SourceFile%" "%DestFile%"

Open in new window

Shaun VermaakTechnical SpecialistCommented:
Do you have Active Directory? Deploy the file as a GPO file preference similar to this
Steve TinsleyAuthor Commented:
No Active Directory. It will be something that we can email out.

Thanks for the script idea.... Because it will be emailed out the xml needs to be in the script.
I thought something like this... But ive got no idea now to do any error checking. Check for success etc....

@echo off

@echo on
ECHO ===== COLORS =====

@echo off

SET SCRIPTPATH=%APPDATA%\Microsoft\Templates\Document Themes\Theme Colors\

@echo on
ECHO Creating XML File
@echo off

ECHO ^<?xml version="1.0" encoding="UTF-8" standalone="yes"?^> >>%SCRIPTFULLPATH%

ECHO ^<a:clrScheme xmlns:a="" name="%SCRIPTXMLNAME%"^> >>%SCRIPTFULLPATH%

ECHO ^<a:dk1^>^<a:sysClr val="windowText" lastClr="000000"/^>^</a:dk1^> >>%SCRIPTFULLPATH%
ECHO ^<a:lt1^>^<a:sysClr val="window" lastClr="FFFFFF"/^>^</a:lt1^> >>%SCRIPTFULLPATH%
ECHO ^<a:dk2^>^<a:srgbClr val="37393A"/^>^</a:dk2^> >>%SCRIPTFULLPATH%
ECHO ^<a:lt2^>^<a:srgbClr val="8C827E"/^>^</a:lt2^> >>%SCRIPTFULLPATH%
ECHO ^<a:accent1^>^<a:srgbClr val="006EB6"/^>^</a:accent1^> >>%SCRIPTFULLPATH%
ECHO ^<a:accent2^>^<a:srgbClr val="00A97A"/^>^</a:accent2^> >>%SCRIPTFULLPATH%
ECHO ^<a:accent3^>^<a:srgbClr val="7CCBE2"/^>^</a:accent3^> >>%SCRIPTFULLPATH%
ECHO ^<a:accent4^>^<a:srgbClr val="6679BA"/^>^</a:accent4^> >>%SCRIPTFULLPATH%
ECHO ^<a:accent5^>^<a:srgbClr val="E6224F"/^>^</a:accent5^> >>%SCRIPTFULLPATH%
ECHO ^<a:accent6^>^<a:srgbClr val="C8B9AF"/^>^</a:accent6^> >>%SCRIPTFULLPATH%
ECHO ^<a:hlink^>^<a:srgbClr val="006EB6"/^>^</a:hlink^> >>%SCRIPTFULLPATH%
ECHO ^<a:folHlink^>^<a:srgbClr val="954F72"/^>^</a:folHlink^> >>%SCRIPTFULLPATH%

ECHO ^</a:clrScheme^> >>%SCRIPTFULLPATH%


Open in new window

Will this work? Any ideas how to improve?
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Bill PrewIT / Software Engineering ConsultantCommented:
Have you done a proof of concept on this in your environment?  Most good email clients and/or antivirus products won't let a BAT file attached to an email anywhere near execution...

One tip in the BAT file itself, you don't need the outer ECHO commands in things like:

@echo on
ECHO Creating XML File
@echo off

Just the actual ECHO in the middle is all you need, it will be shown.  The ECHO OFF and ECHO ON only affect each commadn line being echoed before it gets executed, so if you turn it on for the ECHO's you will see it twice.  Just use:

ECHO Creating XML File

Bill PrewIT / Software Engineering ConsultantCommented:
And if you wanted to play around with it, here's a slightly easier way I use to embed "data" into the BAT script...

@echo off

ECHO ===== COLORS =====

SET SCRIPTPATH=%APPDATA%\Microsoft\Templates\Document Themes\Theme Colors\

ECHO Creating XML File


set WriteFile=
for /f "tokens=1,* delims=]" %%A in ('find /n /v "" "%~f0"') do (
  if defined WriteFile echo.%%B>>%SCRIPTFULLPATH%
  if /i "%%B" == "[XML]" set WriteFile=Y
exit /b

<!-- COLOURS --> 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<a:clrScheme xmlns:a="" name="SCRIPT_COLOURS1"> 
<a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1> 
<a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1> 
<a:dk2><a:srgbClr val="37393A"/></a:dk2> 
<a:lt2><a:srgbClr val="8C827E"/></a:lt2> 
<a:accent1><a:srgbClr val="006EB6"/></a:accent1> 
<a:accent2><a:srgbClr val="00A97A"/></a:accent2> 
<a:accent3><a:srgbClr val="7CCBE2"/></a:accent3> 
<a:accent4><a:srgbClr val="6679BA"/></a:accent4> 
<a:accent5><a:srgbClr val="E6224F"/></a:accent5> 
<a:accent6><a:srgbClr val="C8B9AF"/></a:accent6> 
<a:hlink><a:srgbClr val="006EB6"/></a:hlink> 
<a:folHlink><a:srgbClr val="954F72"/></a:folHlink> 

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If you build the color theme into the template (or theme), then they'll travel with the file and you won't need to install them on everyone's computer.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.