This is my first post on Bleeping Computer, so bear with me. If this should be in a different forum topic, feel free to kindly inform me.
I have a question about incorporating boolean operators into this Windows Batch file script. But first I will give you a little background information on this project and what i'm trying to accomplish.
First off, this is a script to copy our custom Microsoft Office templates off of our server, into the correct folders within each of our employees computers / local accounts on our domain. We are currently in the process of migrating from MS Office 2013 to the 2016 version. The only piece of the puzzle holding me back from full deployment is getting this script to work properly. I am a bit of a novice with scripting.
Here is the script:
ECHO ON SET filecheck="%APPDATA%\templates-201607.txt" IF EXIST "%APPDATA%\templates-201607.txt" (EXIT) ECHO %date% %time% > %filecheck% IF EXIST "%APPDATA%\Microsoft\QuickStyles\" ( robocopy \\thunder\Databases\Templates\20160421\ %APPDATA%\Microsoft\QuickStyles\ "The Center.dotx" /is >> %filecheck% ) IF EXIST "%APPDATA%\Microsoft\Document Building Blocks\1033\16" ( robocopy \\thunder\Databases\Templates\20160421\ "%APPDATA%\Microsoft\Document Building Blocks\1033\16" "Building Blocks.dotx" /is >> %filecheck% ) IF EXIST "%APPDATA%\Microsoft\Templates\" ( robocopy \\thunder\Databases\Templates\20160421\ %APPDATA%\Microsoft\Templates\ *.potx /is >> %filecheck% robocopy \\thunder\Databases\Templates\20160421\ "%APPDATA%\Microsoft\Templates\Document Themes" *.thmx /is >> %filecheck% robocopy \\thunder\Databases\Templates\20160421\ %APPDATA%\Microsoft\Templates\ *.dotm /is >> %filecheck% ) EXIT
The way this script stands right now is functional, HOWEVER, after running a clean install of MS office 2016, I noticed that the folders that are a prerequisite for this script to work properly are not created by the installer. They are only created once the user first time launches some of the MS office 2016 apps. These are: Word, Powerpoint, and Outlook.
If the user does not launch the applications prior to the script being ran, the folders will temporarily not exist, causing the script to either result in error or install the templates incorrectly. This will happen the way the script is now, since it runs when the user logs in through group policy.
The folders in question here are:
-%APPDATA%\Microsoft\Document Building Blocks\1033\16
Now, what i'm looking for help on is how to incorporate the correct boolean operators so that the script checks for these folders EACH TIME the user logs in until the user has launched the applications and the folders exist and the script can finally go ahead and robocopy the files into their locations. My ultimate goal here is to have the script know it needs to wait until the second time it runs at system startup, or whatever number of times it takes for the users to launch the apps, to fully run. I already have IF EXIST statements that check to see if the folders are their, but these will not work for this circumstance i believe. If there is a way, please let me know. If i have to write new statements with different operators, please also let me know.
I appreciate all your help, thank you!