IF commands in a batch file
Posted
by Rossaluss
on Super User
See other posts from Super User
or by Rossaluss
Published on 2010-05-14T18:51:52Z
Indexed on
2010/05/14
18:56 UTC
Read the original article
Hit count: 305
I'm writing a small batch file to replace users' themes and charts in Office and I have the below batch file that works just fine.
cd c:\documents and settings\%username%\application data\microsoft\templates
echo Y|rmdir charts /s
mkdir charts
echo Y|del "c:\documents and settings\%username%\application data\microsoft\templates\document themes\*.*"
net use o: \\servername\sms
copy "o:\ppt themes\charts\*.*" "c:\documents and settings\%username%\application data\microsoft\templates\charts"
copy "o:\ppt themes\Document Themes\*.*" "c:\documents and settings\%username%\application data\microsoft\templates\document themes"
c:
net use o: /delete
Now what I want is the above to only run if it hasn't run before as we'll be pushing this out to all users for around 2 weeks to catch people that aren't in every day.
Is there any way to begin the command with something to look for one of the new themes/charts already pushed down, and if it's present, then have it not run?
Any help on this would be greatly appreciated as I'm pretty new to these batch files.
© Super User or respective owner