Automating the Copy Settings Wizard with Task Scheduler

Problem: I want to backup my SOLIDWORKS settings regularly. Currently, I have an alarm set and once a month I run Copy Settings Wizard*, but I’d really like to just put it on a schedule and forget about it.

Solution: Write a simple batch file and run that through SOLIDWORKS Task Scheduler** as a Custom Task on a daily, weekly, or monthly schedule.

I know this sounds like a lot, but if I can do it, you can do it. I am not a programmer, I’m a Googler. I also had some help from a powerful Wizard friend of mine. Again, to ease your mind – learning, writing, and completing this task took me less than an hour. You’ve got this.

First, I needed to understand what the Copy Settings Wizard was actually doing for me so I knew what instructions to write. When you Save Settings to File, the Copy Settings Wizard is actually exporting a portion of your Windows Registry. What is the registry, you ask? The registry is a database in Windows that contains important information about your system hardware, installed programs and settings, and profiles of each of the user accounts on your computer. Windows continually refers to the information in the registry. You should not need to make manual changes to the registry because programs and applications typically make all of the necessary changes automatically.*** 

For example, when you check a box in SOLIDWORKS Tools > Options, or add a File Location for your templates, or customize your user interface, the registry is updated with that information and Windows refers back to it when you load SOLIDWORKS – this is the part of the registry we will be backing up. To access this information, you’ll go to Start and search ‘regedit‘ and open. The program is named regedt32.exe and is located on a default setup at C:\Windows\System32\regedt32.exe. The Copy Settings Wizard is essentially right-clicking HKEY_CURRENT_USER\Software\Solidworks, choosing Export, and then saving that file at the location you specified.

What it looks like in Copy Settings Wizard:


What it looks like in the background/if you were to back up your settings manually via regedit:


Now that I understand what’s happening in the background, I know what question to ask Google: “How do I export a registry key?” This didn’t quite get me the answer I was looking for. I also know I need to write instructions for the computer to follow, and those instructions will be executed via the Command Prompt, so my final Google query went, “How do I export a registry key command line?” and the first result was this: https://support.microsoft.com/en-us/kb/168589. Long story short, the command line to export a registry key looks like this:


For my instructions, I wrote:



This will save a file called swsettings.reg to my D:\SOLIDWORKS_setup where I keep all of my other customized files. I added a sub-folder called Settings just to stay organized. To test, I opened a Command Prompt by clicking the Start button and typing ‘cmd‘ into the search. The program is named cmd.exe and is located at C:\Windows\System32\cmd.exe (this is the same location as the regedt32.exe).


My test was successful –  I know this because the swsettings.reg file was created:


Now, I needed to figure out how to get these instructions into a format the SOLIDWORKS Task Scheduler could read and understand. I Googled for a bit, but this is where my Wizard friend really came to the rescue. Verbatim, I asked, “Well, now what do I do with it?! How do I save that so the Task Scheduler can read it?!” The powerful Wizard replied, “You should be able to put that into a text file and rename the extension to ‘.bat.’ Then call that from the Task Scheduler – put it in the program path.” Oh, ok. It’s that simple?! Yep. Here we go.

Step 1 – save the instructions you’ve created into a text file. I used Notepad:


Step 2 – modify the file extension to ‘.bat‘ by right-clicking and renaming the file in Windows Explorer. When you finish the rename, you’ll see a dialog asking if you really want to change the extension; click yes:


Please note: the ability to view file extensions is an option in Windows Explorer. If you do not see the file extension in the name, you’ll need to modify this first. The image below is Windows 8.1. For Windows 7 instructions, click here: http://windows.microsoft.com/en-us/windows7/change-folder-options.



Step 3 – create a custom task in the SOLIDWORKS Task Scheduler. I opened by clicking the Start button and typing ‘task’ into the search. (Start > All Programs > SOLIDWORKS 2015 > SOLIDWORKS Tools > SOLIDWORKS Task Scheduler 2015 for Windows 7)


That’s it. I checked to make sure the task was scheduled,


and a few minutes later, I made sure it completed: 


Now, whenever you need to restore your settings backup, all you’ll need to do is double-click the settings.reg file created from your Custom Task.

Thanks for reading!

Some other things I ran into on my journey:

You can copy and paste the folder location into the command prompt by right-clicking and choosing Paste. Ctrl+V will not work.

You can copy the Registry Key name by right-clicking the desired key and choosing Copy Key Name.

Again, you should not need to make manual changes to the registry because programs and applications typically make all of the necessary changes automatically. An incorrect change to your computer’s registry could render your computer inoperable.*** Since we’re not making changes, only a backup, we’re all set. I tell you this so you don’t go making manual changes to the registry if you’re not comfortable with what you’re doing. Please, only make manual changes with help from your support team if necessary.

Cited Resources:
*http://help.solidworks.com/2015/english/solidworks/sldworks/c_copy_settings_wizard.htm
**http://help.solidworks.com/2015/English/SolidWorks/sldworks/c_SolidWorks_Task_Scheduler.htm
***http://windows.microsoft.com/en-us/windows-vista/what-is-the-registry

FISHER/UNITECH
Fisher Unitech is improving manufacturing in America by delivering, supporting and training customers on the best product development software and additive and subtractive manufacturing solutions available. The company delivers 3D software and hardware, which enable customers to design, validate and manage innovative products from prototyping to manufacturing. With more than 17 office locations throughout the Midwest, Mid-Atlantic, and New England. For more information, visit www. FisherUnitech.com.
FISHER/UNITECH
FISHER/UNITECH