Global Variable List

Be sure to have read the help topic “Working with variables” first.

Some variables are defined automatically by Paquet Builder; these pre-defined variables are called Global variables and their values are automatically set by the package itself at runtime. They contain information about the user, system, OS, common paths… You can use them anywhere in your project.

All global variables and their meaning

Note that in the third column “Profile”, “User” refers to the currently logged in user’s profile. “Common” refers to the All Users profile. When a package is run on Windows by an end user without administrative rights, all of the “common” variables are equivalent to the “user” ones. A blank value indicates that the variable is not influenced by the logged-in profile.

Variable nameWhat it containsProfile
%APPDATADIR%Path to the Windows Application Data folder.user
%APPTITLE%Contains the package’s title.
%ARCFILEVER%File version of the package (as defined in Package Resources).
%ARCNAME%Points to the full filename of the Self-Extracting package.
%ARCPATH%Path where is located the Self-Extracting package.
%ARCPRODVER%Product version of the package (as defined in Package Resources).
%COMAPPDATADIR%Path to Windows Application Data folder.common
%COMDESKTOPDIR%Path to desktop folder.common
%COMFAVORITESDIR%Path to Favorites folder. Currently only Windows 2000, Me, XP support it. On other platforms the variable will be the same as %FAVORITESDIR%.common
%COMFILESDIR%Path to Common Files folder.
%COMLOCALAPPDATADIR%Path to local (nonroaming) Application Data folder.common
%COMMYDOCDIR%Path to My Documents folder (or on NT4, the Personal folder).common
%COMPROGMENUDIR%Path to Programs folder on Start Menu.common
%COMSTARTMENUDIR%Path to the top level of Start Menu.common
%COMSTARTUPMENUDIR%Path to Startup folder on Start Menu.common
%COMTEMPLATESDIR%Path to Templates folder. Currently only Windows 2000, Me, and XP support it. On other platforms the variable will be the same as %TEMPLATESDIR%.common
%CUR%Points to the current system folder
%CURDATE%Contains the current date in the following format: “yyyyMMdd”
%CURDATETIME%Contains the current date/time in the following format: “yyyyMMdd hh:mm:ss”
%DESKTOPDIR%Path to desktop folder.user
%DESTPATH%Path to the final destination folder once files were extracted. This variable is not initialized before the file extraction process!
%EXITCODE%An integer value (dword) that contains the exit code that the package process will receive when it closes. See about exit codes and values.
%FAVORITESDIR%Path to Favorites folder.user
%FONTSDIR%Path to Windows Fonts folder.
%IS64OS%Indicates whether Windows is 64-bit (value 1) or 32-bit (value 0). Boolean type: 1 true, 0 false.
%ISADMIN%Indicates whether the user has administrative rights or not. Boolean type: 1 true, 0 false. See below for difference between administrator and power user.
%ISPOWERUSER%Indicates whether the user has power user rights or not. Boolean type: 1 true, 0 false. See below for difference between administrator and power user.
%LOCALAPPDATADIR%Path to local (nonroaming) Application Data folder.user
%MYDOCDIR%Path to My Documents folder (or on NT4, the Personal folder).user
%NEEDREBOOT%Indicates whether the system should be restarted when the package closes. Boolean type: 1 true, 0 false. Note that this variable is indicative only: you have to call the Restart Computer custom action yourself (and ask end users if they want to restart Windows). The value of this variable is automatically set by the package if a file for example could not be replaced because it is locked: click here for more information.
%OSVER%Integer type: indicates the name of the operating system. See below for the different values.
%PARAMCOUNT%Number of command line parameters passed to the package. Defines the number of %PARAMx% variables.
%PARAM%Command line first parameter passed to the package (if any) - blank if none.
%PARAM2%Command line second parameter passed to the package (if any) - blank if none.
%PARAM3%Command line third parameter passed to the package (if any) - blank if none (replace 2 by 3 for third if any - and so on…).
%PARAMx%Command line xth parameter passed to the package (if any) - blank if none (replace x by the position of the argument in command line) - x from 2 to %PARAMCOUNT%.
%PARAMS%Entire command line passed to the package.
%PBDLGNEXTC%Holds the text of the Next button for wizard dialog boxes. This variable is always reset to #Next after a dialog is displayed.
%PBLANGID%Contains the LCID the language the package displays its text in. Useful if you work with multilanguage packages and want to know which language was selected by the user. Can be manually set.
%PBSFXPATH%Path to the loader’s temporary resource folder (see loader additional files)
%PBUNINSTREGKEY%Full registry subkey where uninstaller reference for Add/Remove Program is stored. Indicative-only. Set with Unique Registry Key.
%PROGFILESDIR%Contains the Program Files shell directory.
%PROGMENUDIR%Path to the Programs folder on the Start Menu.user
%QUICKLAUNCHDIR%Path to the Quick Launch shell folder. Currently only Windows 98 (with IE), Me, 2000, and XP support it.user
%SELLANG%Contains the name of the language the package displays its text in. Useful if you work with multilanguage packages and want to know which language was selected by the user.
%SENDTOMENUDIR%Path to the current user’s Send To folder.
%SHORTCUTPATH%Indicates the path to Start Menu Folder where you can optionally place your shortcuts. This variable is actually useful only if you prompt end users to select a Start Menu Folder. Please use it in your custom actions only after the file extraction process.common (if admin is logged) or user
%SILENT%Indicates whether the silent mode is activated or not. Boolean type: 1 true, 0 false. You can change this variable at runtime and manually enable/disable the silent mode if you wish.
%STARTMENUDIR%Path to the top level of Start Menu.user
%STARTUPMENUDIR%Path to Startup folder on Start Menu.user
%SYS%Contains the Windows System path (System32).
%SYSROOT%System Drive. The drive Windows is installed on, typically C:. This is equivalent to the SystemDrive environment variable.
%TEMPLATESDIR%Path to Templates folder.user
%TMP%Points to the User’s local Temporary folder.user
%TOTALEXTFILE%Contains the number of files that were unpacked (this does not take account of files that could have been skipped by end users). If the extraction failed, then %TOTALEXTFILE% will be set to “0”. Thus you may use custom actions to take appropriate measures in that case.
%USERPROFILE%Path to the user’s profile folder. A typical path is C:\Users\Username.user
%WIN%Contains the system’s Windows directory.

Note: It is very important that you use these variables rather than hard-coding values; for instance, if you want to create a shortcut on the Windows Desktop, use %DESKTOPDIR%\Shortcut rather than “C:\Windows\Desktop\Shortcut” or Desktop\Shortcut. This is important because these folders (Desktop, Start Menu, Programs, etc.) may have different names in foreign-language versions of Windows.

Directory backslash

All path variables are always set without a directory end backslash “\“. For example, use “%DESKTOPDIR%\My folder” and not “%DESKTOPDIR%My folder”

Tip: you can use the custom action Perform operation on a variable with varDirectoryWBS or varDirectoryWOBS to add/remove the backslash if necessary.

Windows Known Folders

For optimization reasons, the list above doesn’t offer all Windows Known Folders such as LocalLow and so on. You can use the Get full path of a Windows Known Folder custom action to create a variable with the path to the Known Folder you want.

Regarding %ISADMIN% and %ISPOWERUSER%

Administrators: Members of this group have total control of the desktop, allowing them to complete all tasks. There is also a built-in administrator account that allows administration of the computer.

%ISPOWERUSER% is deprecated. Only for compatibility purpose with old versions.

How to insert a carriage-return line-feed

The character to put a carriage-return-line-feed is “/$ “ (not “\n” contrary to Windows dialog controls and C/C++ language). For instance, to put a carriage-return-line-feed between “Line 1” and “Line 2”, use /$, like “Line1/$Line2”.

Values for %OSVER%

This variable indicates the version of the operating system running the package:

Value (Integer)Windows Version
0Unidentified - future Windows version
1Windows NT 3.5
2Windows NT (up to v4)
3Windows 2000
4Windows XP
5Unknown Windows 9x OS
6Windows 95
7Windows 98
8Windows Me
9Unknown OS running Win32s
10Windows Server 2003 family
11Windows Vista family
12Windows Server 2008 family
18Windows Server 2008 R2 family
13Windows 7 family
14Windows Server 2012 family
15Windows 8 family
16Windows 8.1 family
19Windows Server 2012 R2 family
17Windows 10 family (Tech Preview)
20Windows 10 family (final)

Windows 10 Version

To get the exact Windows 10 version and/or build number, you can use the dedicated action template named “Retrieve Windows 10 Version”.

© G.D.G. Software 2018. All rights reserved.