Back in June 2008 I posted an article about running post-build commands after Windows setup completes. Recently a viewer asked the following question:
Although the method below doesn’t use unattend.xml directly, here’s a way of running a script after Windows setup completes …
After Windows setup completes successfully Windows will look for a script named SetupComplete.cmd in the %WINDIR%\Setup\Scripts\ folder. If this script exists it will be run – post-build commands can be added to that script (create the script if it doesn’t already exist).
Important notes:
- If, for example, your Windows unattended installation source is C:\Source\i386 you would create a folder called “C:\Source\i386\$OEM$\$1\Windows\Setup\Scripts” (without the quotes) and put the SetupComplete.cmd in there. During an unattended installation the entire contents of C:\Source\i386\$OEM$\$1 will be copied to C:\. This also assumes you are installing Windows to C:\Windows – if your location is different you must change the \Windows\Setup\Scripts path above to match your configuration.
- The commands in the SetupComplete.cmd script are executed with local system privilege so it’s a good place to do post-build installations or customisations.
- You CANNOT reboot and continue the actions in SetupComplete.cmd so do not run commands that require a reboot before continuing (e.g. an installation that updates Windows or a program install that forces a reboot).
- Setup won’t verify any exit codes or levels from SetupComplete.cmd either (normally you’d use these to see if the script executed correctly).
This is a very useful way of running post-build commands after Windows setup completes successfully and I’d recommend it for your unattended builds (I use it a lot).
Very nice, thank you, thank you, thank you!!!!
Hi there – I’m glad the post helped! Thanks for the comment.
Also check out SendKeys.NET. I’ve used it for a year now in building keyboard macros embedded in install scripts. Very helpful when something has a pop up message or needs info to be typed. I like it cause it embeds nicely into a batch file.
http://sendkeysnet.blogspot.com
Thanks for the Info Chris, Been using the SetupComplete.cmd in my Scripts folder for my Windows 7 and the applications with the
switches run great,can add Registry entries plus I am able to remove application folders and files after the installs as well, But having one small problem, I need to install a read file or folder to the windows desktop but the permissions or not having a elevated command wont let me.Any Ideas on this would be great! As I said I can use the RMDIR and Del command but the MKDIR and XCopy will not work.
For Bill:

You can use utility called CPAU.EXE and a tips of script unattended (thx Chris)
Search in google.
I think is best solution for you.
Antonio