Ghostscript Silent Install (How-To Guide)

Ghostscript is a Page Description Language (PDL) Interpreter and industry leader in PDF, PostScript, PCL, and XPS rendering and conversion. This article will serve as an informative guide and give you a clear understanding of how to perform a silent installation of Ghostscript from the command line using the EXE installer.

How to Install Ghostscript Silently

Update: As of version 10.01.0 the silent install option for Ghostscript is no longer permitted. It appears the developer has drawn a line in the sand and will not re-enable the silent install feature for Ghostscript: https://artifex.com/news/ghostscript-10.01.0-disabling-silent-install-option

So what are the options moving forward?

  1. Build Ghostscript from source (PC version) and re-enable the silent install option
  2. Repackage the Ghostscript EXE into an MSI
  3. Use AutoIt to script & automate the installation
  4. Uninstall Ghostscript & find an alternative

Ghostscript Install Unattended Using AutoIt

Note: This example is for deployments where no other version of Ghostscript is already installed

  • Download Ghostscript to a folder created at (C:\Downloads)
  • Install AutoIt (This is only required to compile the script below, once the script is compiled AutoIt can be uninstalled and is not required to deploy across other systems)
  • Open the SciTE Script Editor or your favorite text editor
  • Add the following lines of code:
#RequireAdmin
$PID = ProcessExists("TSProgressUI.exe") ; Will return the PID or 0 if the process isn't found.
If $PID Then ProcessClose($PID)

; MsgBox(0, "", "Did Progress UI Close?")

$InstallPathPattern = @ScriptDir & "\gs*.exe"
$InstallFile = ""

$search = FileFindFirstFile($InstallPathPattern)
If $search <> -1 Then
    $InstallFile = FileFindNextFile($search)
    FileClose($search)
EndIf

If $InstallFile <> "" Then
    $InstallPath = @ScriptDir & "\" & $InstallFile
    Run($InstallPath)
Else
    MsgBox(4096, $InstallPathPattern, "No matching file found for pattern: " & $InstallPathPattern)
    Exit
EndIf

WinWaitActive("GPL Ghostscript Setup", "Welcome to GPL Ghostscript Setup")
ControlClick("GPL Ghostscript Setup", "Welcome to GPL Ghostscript Setup", "[CLASS:Button; INSTANCE:2]")

WinWaitActive("GPL Ghostscript Setup", "License Agreement")
ControlClick("GPL Ghostscript Setup", "License Agreement", "[CLASS:Button; INSTANCE:2]")

WinWaitActive("GPL Ghostscript Setup", "Choose Install Location")
ControlClick("GPL Ghostscript Setup", "Choose Install Location", "[CLASS:Button; INSTANCE:2]")

WinWaitActive("GPL Ghostscript Setup", "Completing GPL Ghostscript Setup")
ControlClick("GPL Ghostscript Setup", "Completing GPL Ghostscript Setup", "[CLASS:Button; INSTANCE:2]")

WinWaitActive("GPL Ghostscript Setup", "Installation Complete")
ControlClick("GPL Ghostscript Setup", "Installation Complete", "[CLASS:Button; INSTANCE:1]")
  • Save the file to C:\Downloads and name it: Ghostscript.au3
  • Right-Click on Ghostscript.au3 & select Compile Script
  • This will create a file called Ghostscript.exe
    • You should now see the following files in the C:\Downloads directory
      • Ghostscript.au3
      • Ghostscript.exe
      • gsXXXXXw64.exe
  • Open an Elevated Command Prompt by Right-Clicking on Command Prompt and select Run as Administrator
  • Navigate to the C:\Downloads folder
  • Enter the following command: Ghostscript.exe /S

Ghostscript Upgrade Unattended Using AutoIt

Note: This example is for deployments where another version of Ghostscript is already installed and needs to be upgraded

  • Download Ghostscript to a folder created at (C:\Downloads)
  • Install AutoIt (This is only required to compile the script below, once the script is compiled AutoIt can be uninstalled and is not required to deploy across other systems)
  • Open the SciTE Script Editor or your favorite text editor
  • Add the following lines of code:
#RequireAdmin
$PID = ProcessExists("TSProgressUI.exe") ; Will return the PID or 0 if the process isn't found.
If $PID Then ProcessClose($PID)

; MsgBox(0, "", "Did Progress UI Close?")

$InstallPathPattern = @ScriptDir & "\gs*.exe"
$InstallFile = ""

$search = FileFindFirstFile($InstallPathPattern)
If $search <> -1 Then
    $InstallFile = FileFindNextFile($search)
    FileClose($search)
EndIf

If $InstallFile <> "" Then
    $InstallPath = @ScriptDir & "\" & $InstallFile
    Run($InstallPath)
Else
    MsgBox(4096, $InstallPathPattern, "No matching file found for pattern: " & $InstallPathPattern)
    Exit
EndIf

WinWaitActive("GPL Ghostscript Setup", "Welcome to GPL Ghostscript Setup")
ControlClick("GPL Ghostscript Setup", "Welcome to GPL Ghostscript Setup", "[CLASS:Button; INSTANCE:2]")

WinWaitActive("GPL Ghostscript Setup", "Uninstall Ghostscript Version")
ControlClick("GPL Ghostscript Setup", "Uninstall Ghostscript Version", "[CLASS:Button; INSTANCE:1]")

WinWaitActive("GPL Ghostscript Uninstall: Confirmation", "")
ControlClick("GPL Ghostscript Uninstall: Confirmation", "", "[CLASS:Button; INSTANCE:2]")

WinWaitActive("GPL Ghostscript Uninstall ", "Completed")
ControlClick("GPL Ghostscript Uninstall ", "Completed", "[CLASS:Button; INSTANCE:2]")

WinWaitActive("GPL Ghostscript Setup", "License Agreement")
ControlClick("GPL Ghostscript Setup", "License Agreement", "[CLASS:Button; INSTANCE:2]")

WinWaitActive("GPL Ghostscript Setup", "Choose Install Location")
ControlClick("GPL Ghostscript Setup", "Choose Install Location", "[CLASS:Button; INSTANCE:2]")

WinWaitActive("GPL Ghostscript Setup", "Completing GPL Ghostscript Setup")
ControlClick("GPL Ghostscript Setup", "Completing GPL Ghostscript Setup", "[CLASS:Button; INSTANCE:2]")

WinWaitActive("GPL Ghostscript Setup", "Installation Complete")
ControlClick("GPL Ghostscript Setup", "Installation Complete", "[CLASS:Button; INSTANCE:1]")
  • Save the file to C:\Downloads and name it: Ghostscript_Upgrade.au3
  • Right-Click on Ghostscript.au3 & select Compile Script
  • This will create a file called Ghostscript_Upgrade.exe
    • You should now see the following files in the C:\Downloads directory
      • Ghostscript_Upgrade.au3
      • Ghostscript_Upgrade.exe
      • gsXXXXXw64.exe
  • Open an Elevated Command Prompt by Right-Clicking on Command Prompt and select Run as Administrator
  • Navigate to the C:\Downloads folder
  • Enter the following command: Ghostscript_Upgrade.exe /S

Ghostscript (32-bit) Silent Install (EXE) – Versions 10.0.0 & Older

  1. Navigate to: https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs1000/gs1000w32.exe
  2. Download the gs1000w32.exe to a folder created at (C:\Downloads)
  3. Open an Elevated Command Prompt by Right-Clicking on Command Prompt and select Run as Administrator
  4. Navigate to the C:\Downloads folder
  5. Enter the following command: gs1000w32.exe /S
  6. Press Enter

After a few moments you should see the Ghostscript shortcut in the Start Menu, Installation Directory, and Programs and Features in the Control Panel.

Software Title:GPL Ghostscript
Vendor:Artifex Software Inc.
Architecture:x86
Installer Type:EXE
Silent Install Switch:gs1000w32.exe /S
Silent Uninstall Switch (32-bit System)"%ProgramFiles%\gs\gsx.y.z\uninstgs.exe" /S
Silent Uninstall Switch (64-bit System)"%ProgramFiles(x86)%\gs\gsx.y.z\uninstgs.exe" /S
Download Link:Ghostscript Download
PowerShell Script:Ghostscript | PowerShell Script
Detection Script:Ghostscript | Custom Detection Script

Ghostscript (64-bit) Silent Install (EXE)- Versions 10.0.0 & Older

  1. Navigate to: https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs1000/gs1000w64.exe
  2. Download the gs1000w64.exe to a folder created at (C:\Downloads)
  3. Open an Elevated Command Prompt by Right-Clicking on Command Prompt and select Run as Administrator
  4. Navigate to the C:\Downloads folder
  5. Enter the following command: gs1000w64.exe /S
  6. Press Enter

After a few moments you should see the Ghostscript shortcut in the Start Menu, Installation Directory, and Programs and Features in the Control Panel.

Software Title:GPL Ghostscript
Vendor:Artifex Software Inc.
Architecture:x64
Installer Type:EXE
Silent Install Switch:gs1000w64.exe /S
Silent Uninstall Switch:"%ProgramFiles%\gs\gsx.y.z\uninstgs.exe" /S
Download Link:Ghostscript Download
PowerShell Script:Ghostscript | PowerShell Script
Detection Script:Ghostscript | Custom Detection Script

The information above provides a quick overview of the software title, vendor, silent install, and silent uninstall switches. The download link provided take you directly to the vendors website. Continue reading if you are interested in additional details and configurations.


Additional Configurations

Change the Ghostscript Default Installation Directory

You can also change the default installation directory by using the following command line parameters. In this example, I’m installing Ghostscript to “C:\Ghostscript”

gs1000w64.exe /S /D=C:\Ghostscript

How to Uninstall Ghostscript Silently

Check out the following posts for a scripted solution:

Ghostscript Install and Uninstall (PowerShell)
Ghostscript Silent Uninstall (PowerShell)
  1. Open an Elevated Command Prompt by Right-Clicking on Command Prompt and select Run as Administrator
  2. Enter one of the following commands:

Ghostscript 32-bit Silent Uninstall (EXE) on 32-bit System

"%ProgramFiles%\gs\gsx.y.z\uninstgs.exe" /S

Ghostscript 32-bit Silent Uninstall (EXE) on 64-bit System

"%ProgramFiles(x86)%\gs\gsx.y.z\uninstgs.exe" /S

Ghostscript 64-bit Silent Uninstall (EXE) on 64-bit System

"%ProgramFiles%\gs\gsx.y.z\uninstgs.exe" /S

Always make sure to test everything in a development environment prior to implementing anything into production. The information in this article is provided “As Is” without warranty of any kind.