Scripts !    

Here is a sample of how to use a Batch script files (.bat) to create dynamic tSQL scripts (.sql) and execute them.  This is an example of how I copied Production databases into Non-Production databases (like a LAB) after stripping out any Production/Confidential data (customers numbers, etc.) - called "scrubbing" or "sanitizing" the DB.
  Contact me [steve <at> if you have questions, ideas, or suggestions.

   ->  This script creates 3 .sql scripts to:

  1. restore a Production DB from a .bak file to a Temporary DB
  2. backup the "scrubbed" Temporary DB
  3.  Delete the Temporary DB and all of the temporary .sql scripts.
  (note: AutoScrub-Lab.ps1 calls a special tSql script  to remove customers
   data. It is propriatary, so I didn't include it here )
Here are the output files created by the .bat script on the Left: