LiberKeyPortabilizer : Basic usage

Quick navigation

Structure overview

Structure_overview_LiberKeyPortabilizerFile.lpf
<LiberKeyAppLauncher version="0.7">
	<OtherInstanceWarning active="yes" fast_user_switching="no"/>
        <AppInfo>
                <Name></Name>
                <LocalExeName></LocalExeName>
                <AdditionalLocalExeList>
                        <ExeMask></ExeMask>
                        <ExeMask></ExeMask>
                </AdditionalLocalExeList>
 
 		<ExePath></ExePath>
                <Exe64Path></Exe64Path>
 
		<AdditionalExeList>
                        <ExeMask></ExeMask>
                        <ExeMask></ExeMask>
                </AdditionalExeList>
 
                <SingleInstance active="yes"/>
                <AdditionalParameters></AdditionalParameters>
                <DefaultDir></DefaultDir>
                <TmpDir active="yes"></TmpDir>
                <Dependencies>
                        <DotNet></DotNet>
                </Dependencies>
        </AppInfo>
        <EnvironmentVars>
                <EnvVar name=""></EnvVar>
        </EnvironmentVars>
        <Registry>
                <RegSettings regfile="">
                        <Section></Section>
                        <Value></Value>
                        <SectionKill></SectionKill>
                </RegSettings>
                <RegReplace>
                        <RegVar>
                                <RegValue></RegValue>
                                <StringID></StringID>
                                <Replace></Replace>
                        </RegVar>
                </RegReplace>
        </Registry>
        <AppData>
                <DataFile>
                        <DataPath></DataPath>
                        <KeyDataPath></KeyDataPath>        
                        <FolderKill></FolderKill>
                </DataFile>
                <DataReplace>
                        <DataVar>
                                <DataFile></DataFile>
                                <StringID></StringID>
                                <Replace></Replace>
                        </DataVar>
                </DataReplace>
        </AppData>
</LiberKeyAppLauncher>

LiberKeyAppLauncher

This node is mandatory

LiberKeyAppLauncher is the root node.
It contains a version number linked to the LiberKeyPortabilizer capabilities.

The current version is 0.7 : you must use this version in your XML.

<LiberKeyAppLauncher version="0.7">
 
</LiberKeyAppLauncher>

OtherInstanceWarning

  • active: enable/disable the detection of an other version of the application (with a different path) after that the portable version is running. Value : yes/no (default : yes)
  • fast_user_switching: enable/disable execution of an application from an other user session. Value : yes/no (default : no)

Code:

<OtherInstanceWarning active="yes" fast_user_switching="no"/>

AppInfo

This node is mandatory

Name

This node is mandatory

Application name used in the messages.

Example:

<Name>Gimp</Name>

LocalExeName

This node is mandatory

Name of the local executable: used to detect local instances.

Example:

<LocalExeName>gimp-2.6.exe</LocalExeName>

AdditionalLocalExeList

Name of additional local executables (same used than LocalExeName)

Structure:

<AdditionalLocalExeList>
       <ExeMask></ExeMask>
       <ExeMask></ExeMask>
</AdditionalLocalExeList>

ExePath

This node is mandatory

Path of the executable: relative to the .lpf file path

Example:

<ExePath>App\ProcessHacker\x86\ProcessHacker.exe</ExePath>

Exe64Path

Path of the 64 bits executable: relative to the .lpf file path

Example:

<Exe64Path>App\ProcessHacker\x64\ProcessHacker.exe</Exe64Path>

AdditionalExeList

The path to the “satellite” application. If any of these executables is still working the portabilisation process isn't stopped.

Structure:

<AdditionalExeList>
       <ExeMask></ExeMask>
</AdditionalExeList>

SingleInstance

Prevent multiple instance running of the application.

  • active: value yes/no (default: no)
<SingleInstance active="no"/>

AdditionalParameters

Defines parameters that are routinely added to the command line when calling the executable

Example:

<AdditionalParameters>-settings "%LBK_APP_PATH%\Data\settings\settings.xml"</AdditionalParameters>

DefaultDir

Folder that the application perceives as its “Workingdir'

Example:

<DefaultDir>%LBK_APP_PATH%\App\VLC</DefaultDir>

TmpDir

Sets a temporary directory specific to the application. It will be in the %TEMP% of Windows.

Example:

<TmpDir>LBKTemp_Gimp</TmpDir>

Dependencies

Specifies the dependencies needed to run the application.

Only. NET framework is currently available.

Example:

<Dependencies>
	<DotNet>2.0</DotNet>
</Dependencies>

EnvironmentVars

List of environment variables to set before starting the application.

Structure:

<EnvironmentVars>
       <EnvVar name=""></EnvVar>
       <EnvVar name=""></EnvVar>
</EnvironmentVars>

EnvVar

Example:

<EnvironmentVars>
    <EnvVar name="GIMP2_DIRECTORY">%LBK_APP_PATH%\Data\profile</EnvVar>
</EnvironmentVars>

Registry

Save and restore registry keys.

Structure:

<Registry>
       <RegSettings regfile="">
              <Section></Section>
               <Value></Value>
               <SectionKill></SectionKill>
       </RegSettings>
       <RegReplace>
               <RegVar>
                       <RegValue></RegValue>
                       <StringID></StringID>
                       <Replace></Replace>
               </RegVar>
       </RegReplace>
</Registry>

RegSettings

Attribute regfile: defines the filename for the backup of the registry (relative to the launcher)
Attribute level: defines whether the treatment is required to launch the application values: optional / required (default)

Example:

<RegSettings regfile="Data\7-zip.reg" level="optional">
	<Section>HKEY_CURRENT_USER\Software\7-zip</Section>
</RegSettings>

Section

Defines the sections of the registry to save/restore
Available : HKCU, HKCR, KHLM or HKEY_CURRENT_USER, HKEY_CLASSES_ROOT, HKEY_LOCAL_MACHINE

Example:

<Section>HKEY_CURRENT_USER\Software\7-zip</Section>

Value

Defines the full path to a value in the registry
This value is treated alone. Neighboring values in the section are not affected.

Example:

<Value>HKCU\Software\7-zip\Options\WorkDirPath</Value>

SectionKill

Defines a section name (key) to be deleted after restoring the original context.
By default, the section is not deleted if there are entries / keys inside.
To force the removal of the section, although there is data after restoration,put the attribute force=“yes”

Example:

<SectionKill force="no">HKCU\Software\7-zip\Extraction</SectionKill>

RegReplace

Sets a variable context-dependent.
The replacement operation in the registry are made:

  1. before launching the app to replace stringID by their values
  2. after closing the app to replace the values by their respective stringID

Example:

<RegReplace>
	<RegVar>
		<RegValue>HKCU\Software\7-zip\Options\WorkDirPath</RegValue>
		<StringID>_LBK_APP_PATH_</StringID>
		<Replace compare="txt">%LBK_APP_PATH%</Replace>
	</RegVar>
</RegReplace>

RegVar

RegValue

Defines the full path to the value of the registry to change

Example:

<RegValue>HKCU\Software\7-zip\Options\WorkDirPath</RegValue>
StringID

ID of the string Example:

<StringID>_LBK_APP_PATH_</StringID>
Replace

Replacement value may contain environment variables.
compare : attribute that defines the type of comparison.

  • “txt” comparison in text mode (not case sensitive)
  • “binary” comparison in binary mode (case sensitive)

Example:

<Replace compare="txt">%LBK_APP_PATH%</Replace>

AppData

Save and restore files or folders.

Structure:

<AppData>
       <DataFile>
               <DataPath></DataPath>
               <KeyDataPath></KeyDataPath>                        
               <FolderKill></FolderKill>
       </DataFile>
       <DataReplace>
		<DataVar>
			<DataFile></DataFile>
			<StringID></StringID>
			<Replace compare="txt"></Replace>
		</DataVar>
       </DataReplace>
</AppData>

DataFile

Structure:

<DataFile>
	<DataPath></DataPath>
	<KeyDataPath></KeyDataPath>                        
	<FolderKill></FolderKill>
</DataFile>

DataPath

Defines the path of a file or folder (locally) used by the application

Structure:

<DataPath>%APPDATA%\vlc</DataPath>

KeyDataPath

Defines the path (relative to the launcher) for the backup of this file / folder on the key

Structure:

<KeyDataPath>Data\settings\vlc</KeyDataPath>

FolderKill

Specifies a directory to be deleted if it is empty.

force: defines the type of removal of the directory if not empty

  • Value: “yes” force folder deletion
  • Value: “no” don't force deletion (default)

Structure:

<FolderKill force="no"></FolderKill>

DataReplace

Sets of strings to replace in files of the application.

Structure:

<DataReplace>
	<DataVar>
		<DataFile></DataFile>
		<StringID></StringID>
		<Replace compare="txt"></Replace>
	</DataVar>
</DataReplace>

DataVar

Sets a variable dependent on the context.
Same operation as for the registry, but it has defined a file instead of an entry in the registry

Structure:

<DataVar>
	<DataFile></DataFile>
	<StringID></StringID>
	<Replace compare="txt"></Replace>
</DataVar>
DataFile

Set the path to the file to edit.

Example:

<DataFile>%LBK_APP_PATH%\App\MyApplication\session.xml</DataFile>
StringID

Example:

<StringID>_LBK_MYDOCS_PATH_</StringID>
Replace

Example:

<Replace compare="txt">%LBK_MYDOCS_PATH%</Replace>

Environment variables

Table of internal (LiberKeyPortabilizer) environment variables

Name Value
%LBK_APP_PATH%Directory of the application (where the .lpf is loaded)
%LBK_APP_DRIVE%Drive of the application (eg: E:)
%LBK_APP_DRIVE_LETTER%Drive of the application with only the letter (eg: E)
%LBK_ROOT%Root of LiberKey (LiberKey.exe)
%LBK_APPS_PATH%Folder Apps
%LBK_TOOLS_PATH%Folder LiberKeyTools
%LBK_MYAPPS_PATH%Folder MyApps
%LBK_MYDOCS_PATH%Folder MyDocuments

Environment variables can be changed before being returned.
Following transformations for variables are available:

Type Syntax Result
Double-slash%ds.VARNAME%"\" becomes "\\"
Simple slash%ss.VARNAME%"\\" becomes "\"
Unix slashes%us.VARNAME%"\" becomes "/"
Windows slashes%ws.VARNAME%"/" becomes "\"
Lower case%lc.VARNAME% from UPPERCASE to lowercase
Upper case%uc.VARNAME% from lowercase to UPPERCASE
Short path%sp.VARNAME%Path with ~
Long path%lp.VARNAME%Path without ~

Table of global environment variables

Name Value
%USERNAME%Current username
%APPDATA%C:\Users\%USERNAME%\AppData\Roaming
%COMMON_APPDATA%C:\ProgramData
%COMMON_DESKTOPDIRECTORY%C:\Users\Public\Desktop
%DESKTOPDIRECTORY%C:\Users\%USERNAME%\Desktop
%LOCAL_APPDATA%C:\Users\%USERNAME%\AppData\Local
%MYPICTURES%C:\Users\%USERNAME%\Pictures
%MYVIDEO%C:\Users\%USERNAME%\Videos
%MYMUSIC%C:\Users\%USERNAME%\Music
%PERSONAL%C:\Users\%USERNAME%\Documents
%PROFILE%C:\Users\%USERNAME%
%PROGRAM_FILES_COMMON%C:\Program Files (x86)\Common Files
%SENDTO%C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\SendTo