Home > Technical Support > FAQ > Silent and command-line installs

FAQ: Silent and command-line installs

How do I install Sketchpad silently and are there command-line options for installing and registering?

Installing Sketchpad silently

The Windows installer (InstallSketchpad.exe) may be run silently by passing it a "/S" command-line option.  Additionally, the application may be registered during the command-line installation by passing the registration information as well.

Example*:

InstallSketchpad.exe /S /name=NAME /code=CODE

Registering Sketchpad silently

The application may be registered after it has been installed by passing it the license name and authorization code on the command-line, along with a registration request.

Windows example*:

GSP5.exe -license register -name "NAME" -code CODE

Macintosh example*:

GSP5.app/Contents/MacOS/GSP5_Rel_KCPT_31_105 -license register -name "NAME" -code CODE

Note that there is no Macintosh installer. To silently install and register a Macintosh application, copy it to the desired location and run the registration command above.

For more details on using these and other command-line options, see the relevant sections below.

Uninstalling Sketchpad silently

The Windows uninstaller (Uninstall.exe, stored next to the application after a successful install) may be run silently by passing it a "/S" command-line option.  Additionally, the application may be deregistered during the command-line installation by passing that information as well.

Example*:

Uninstall.exe /S /name=NAME /code=CODE

Deregistering Sketchpad silently

The application may be deregistered without uninstalling by passing it the license name and authorization code on the command-line, along with a deregistration request.

Windows example*:

GSP5.exe -license deregister -name "NAME" -code CODE

Macintosh example*:

GSP5.app/Contents/MacOS/GSP5_Rel_KCPT_31_105 -license deregister -name "NAME" -code CODE

Note that there is no Macintosh uninstaller. To silently uninstall and deregister a Macintosh application, run the deregistration command above and then delete the application.

For more details on using these and other command-line options, see the relevant sections below.

Updating Sketchpad silently

Updating and installing are the same action. Simply run the Windows installer and install over the previous version, or copy the Macintosh application over the previous version. The current registration will remain in effect after the new version is installed.

Installer and uninstaller command-line options

The Windows installer and uninstaller include several options to help administrators. The following options work for both the installer and uninstaller and assume that you will be registering at install time and deregistering at uninstall time.

  • /name= - Designates the license name to register or deregister.
  • /code= - Designates the authorization code to register or deregister.
  • /S - Install or uninstall silently.
  • /F - Force a registration. When passing this option to the installer, the registration will write over any previous registration on the computer. When passing this option to the uninstaller, the license server will mark your computer as deregistered even if that computer is not currently registered.
  • /dir= - (Installer only) Designates the directory in which Sketchpad should be installed. If this is left out, the default install directory is \Program Files\Sketchpad.
  • _?= - (Uninstaller only) Designates the location to uninstall. This is only necessary when an error code return value is required of the uninstaller to determine if the uninstall succeeded. In this scenario, the administrator must copy the uninstaller outside of the install folder and execute it with the path to the original installation passed on the command-line. This is necessary to capture a return value as the uninstaller would otherwise simply make a copy of itself, execute that copy, then exit with a successful return value. By passing the "_?=" option, this  self-copying procedure does not occur and the uninstaller will return a value based on whether or not the uninstall (and deregistration, if desired) succeeded, and not based on whether the copy procedure succeeded. Note that this option MUST be the last option passed on the command-line and the path must NOT be contained in quotes.

Example install*:

InstallSketchpad.exe /S /F /dir=C:\Program Files\Sketchpad /name=NAME /code=CODE

Example uninstall*:

Uninstall.exe /S /F  /name=NAME /code=CODE _?=C:\Program Files\Sketchpad

Sketchpad registration and deregistration command-line options

The following options are available in the Sketchpad application directly and do not require the use of an installer. They are made available primarily to assist administrators who need to register or deregister Sketchpad but are in a situation where it makes less sense to do so through the installer. Additionally, on Macintosh there is no installer, which means that these command-line options are the best way for an administrator to register the application on multiple computers.

  • -license [register | deregister | info] - Designates which registration action to perform. Choosing "register" or "deregister" requires that the name and code (see below) are included as well. The "info" option simply checks whether or not Sketchpad is registered on the computer.
  • -name - Designates the license name to register or deregister, requiring quotes around license names that contain spaces.
  • -code - Designates the authorization code to register or deregister.
  • -all_users_only - set the registration to apply for all users of the computer.
  • -current_user_only - set the registration to apply for only the current user of the computer.

Windows example*:

GSP.exe -license register -name "NAME" -code CODE -all_users_only

Macintosh example*:

GSP5.app/Contents/MacOS/GSP5_Rel_KCPT_31_105 -license info

Note that the inner executable of the Macintosh application bundle must be called to execute the application on the command-line.

Application registration and deregistration errors

Running the application on the command-line with the above options will succeed with no notification to the user and return a value of zero. If an error occurs, a descriptive text error will be displayed after the execution and the application will return a non-zero error code.

Windows installer and uninstaller errors

Running the windows installer on the command-line with the above options will succeed with no notification to the user. The installer is currently not able to display a text-based error on the command-line and is only able to return one of three error codes: 0 for success, 1 for a user cancellation, and 2 for another error (install path could not be written, registration is invalid, etc.). Catching these errors can be useful in determining that something went wrong and needs to be investigated.

Note that the installer will only attempt to register after the installation has completed, so a problem with the registration means that Sketchpad and all of its components are otherwise completely installed. In the uninstaller, deregistration occurs before the application and its components are uninstalled, so a deregistration error means that no part of the uninstall succeeded. 

Capturing error codes

The error codes returned by the application and the installer can be captured to determine whether or not the install and/or registration succeeded. These error codes will not be displayed as text in the command-line but they can be caught by administrative install tools which are executing these applications via the command-line.

In order to determine whether a command-line action succeeded, it should be run in a script similar to those described below.

Windows batch file

Create a text file with a name ending in ".bat," and place it next to the application. The first line should be the command to execute and the line "echo %errorlevel%" should follow. For example*, the file "register.bat"  contains two lines:

GSP5.exe -license register -name NAME -code CODE

echo %ERRORLEVEL%

In the DOS Command Prompt, cd to the directory containing both the application and the new batch file and execute the command "register.bat" which will run the batch file. The registration will be attempted and, if there is an error, the text of the error will be displayed along with the numerical error code.

The file may have any name, as long as it ends in .bat, and it must be placed next to the application. Any command-line procedure may be replaced in the example above, including an execution of the installer on the command-line. In this case, however, the .bat file must be placed next to the installer instead of Sketchpad.

Macintosh shell script

Create a text file ending in ".sh" where the first line is "#!/bin/bash" and the second line is the command to execute, followed by "echo $?" to display the errors.  For example*, a file called "register.sh" will contain these three lines:

#!/bin/bash

/Applications/GSP5.app/Contents/MacOS/GSP5_Rel_KCPT_31_105 -license register -name NAME -code CODE

echo $?

Place this file next to the executable GSP5.app, open a Terminal and cd to the directory containing the application and the new script. Change the permissions on the script so that it can be executed, using the command "chmod 775 register.sh" and then "./register.sh" to run the command. The registration will be attempted and, if there is an error, the text of the error will be displayed along with the numerical error code.

* In these examples, replace NAME and CODE with the license name and authorization code given to you when your Sketchpad license was purchased.