logo
Published on Vision Multimedia Technologies, LLC (http://www.vmtllc.com)

Automating Deployment Process Using Windows Context Menus

By jcapellman
Created 06/17/2008 - 4:42pm

During deployments to Staging, Pre-Production and Production environments you typically have a good number of SQL scripts that you need to run. One solution would be to just take a directory listing straight from a command prompt and dump it into a batch file. This gets tedious, so I wrote a C# command line application to attach a text file to the batch script (to include instructions and any other important information) and then populate batch files for the Staging, Pre-Production and Production environments. The problem with that solution was I would have to dump the executable into the directory that had all of these SQL scripts. Again, a tedious task. The solution I found was using Windows' built in Context Menu feature. By associating the .sql extension with my C# application I can simply right click on any sql file and it will generate all of the batch script files I need for all three environments. I tested this on both a Windows XP 32bit and 64bit machine, but it should standardized across all Win32/Win64 platforms. The process is all of 7 steps: 1)Open up Windows Explorer (Windows Key + E from the keyboard) 2)Goto Tools->Folder Options 3)Click the File Types Tab 4)Scroll down to SQL or whatever file you are trying to automate. If it's not there you will need to add it by clicking on the "New" button 5)After either creating it or selecting it, with the file type selected, click "Advanced" 6)Click the "New" button 7)A dialog box should pop up showing two text boxes. The action text box contains what will show up when you right click on the file. I called mine "Create Script". After typing in the action name, click "browse" and file where your executable is located. After which click "Ok" and then "Close". You should now have a context menu with the text you specified on the file type you added the context menu to, no restart is necessary.


Source URL:
http://www.vmtllc.com/automating-deployment-process-using-windows-context-menus