There are a number of useful functions SolidWorks® users can run from a command line or simple batch file. For example:
Export the Windows® Registry settings for SolidWorks: these settings define the options and settings for SolidWorks. The exported registry (.reg) file can be used to save and share standard settings.
Remove the settings from an old version prior to installing a new version of SolidWorks.
Run a silent installation or update of SolidWorks.
Silently uninstall SolidWorks (Install Shield or Windows Installer [WI]).
Copy shortcuts to the desktop or Quick Start menu.
While using batch files may seem simplistic, it does offer some advantages over developing custom programs (i.e., Visual Basic®). The advantages are that they are simple to create, easy to modify, and they do not require programming skills.
The examples that follow could be used to prepare a system from a new version (Pre-Install) and configure (Post-Install) the new version. These examples could also be used for other purposes.
Pre-Install Example The following is an example of a batch file that could be used prior to installing SolidWorks. This is just an example as only one of the uninstall applications would be used. The advantage to tying these functions together would be that this batch file can be run on a client machine to automate certain administration functions.
echo off
REM PreUpdate.bat V1.3
REM **********************************************************
REM This will export the SolidWorks registry (/s = silent, /e = export)
REGEDIT /s /e swOptions.reg HKEY_CURRENT_USER\Software\SolidWorks
REM **********************************************************
REM Uninstall a Installshield based old version of SolidWorks 2003. Note that
REM the following command should appear on one line.
REM RunDll32 C:\\PROGRA~1\\COMMON~1\\INSTAL~1\\engine\\6\\INTEL3~1\\Ctor.dll,LaunchSetup \"C:\\Program Files\\InstallShield Installation Information\\{606D713B-B60C-11D6-A47A-00B0D03E4223}\\Setup.exe\" -uninst
REM **********************************************************
REM Uninstall a Installshield based old version of SolidWorks 2001Plus. Note that
REM the following command should appear on one line.
REM RunDll32 C:\\PROGRA~1\\COMMON~1\\INSTAL~1\\engine\\6\\INTEL3~1\\Ctor.dll,LaunchSetup \"C:\\Program
Files\\InstallShield Installation Information\\{CE6AE700-BDAA-11D5-BDCA-00C04F019809}\\Setup.exe\" -uninst
REM **********************************************************
REM Uninstall a WI based old version of SolidWorks.
REM msiexec.exe /x \English_i386_SolidWorks.msi
REM **********************************************************
REM After uninstalling SolidWorks, the directory for the old version of SolidWorks still
REM exists. This is done because of template files. This removes the old directory prior to
REM installing a new version.
REM rmdir /s /q "c:\Program Files\SolidWorks"
REM **********************************************************
REM Clear the Windows registry of old versions of SolidWorks
reg import Wipe-ALL-SW-CUandLM.reg
exit
Post-Install Example The following is an example of a batch file that could be used after installing SolidWorks.
REM **********************************************************
echo off
REM Update.bat V1.3
REM **********************************************************
REM DESCRIPTION:
REM This batch file shows examples on how-to copies shortcuts to the desktop or
REM quick launch menu. Create the shortcut (.lnk), place it in the Admin directory,
REM change and add the names below, this to the install application using the
REM SWInstallAdmin tool.
REM INSTRUCTIONS:
REM 1) Remove the REM on the lines to run with this function.
REM 2) Add other features or functions that can be driven from a batch file.
REM **********************************************************
REM Copy a shortcut (.lnk) to the Quick Launch for the default user.
copy SolidWorks.lnk "c:\Documents and Settings\Default User\Application Data\Microsoft\Internet Explorer\Quick Launch"
REM **********************************************************
REM Copy a shortcut (.lnk) to the Quick Launch for the current user. Replace copy .lnk "c:\Documents and Settings\"%username%"\Application Data\Microsoft\Internet
Explorer\Quick Launch"
REM **********************************************************
REM Copy a shortcut (.lnk) to the Desktop for all users. Replace Copy SolidWorks.lnk "c:\Documents and Settings\All Users\Desktop"
REM **********************************************************
REM This will import the SolidWorks options (/i = import, /s=silent)
REGEDIT /s /i swOptions.reg
exit
Conclusion These
simple functions can be run separately or combined to help you effectively
manage your SolidWorks environment. The functions listed are a sample
of what can be done without going to the extent of developing programs
to help manage or automate your administration tasks.