yaP yet another Portablizer

yaP is a universal DIY style launcher for creating portable applications on Windows.

How yaP works

When launching yaP it reads settings from an ini file to what files/directories to copy and which registry keys to backup, etc. Then launches the main application and waits until it is closed. When that happens, yaP saves application settings to the portable directory and restores local backups.

Highlights

  • portablize applications by listing directories, files, registry keys and values in an ini file
  • automatically run the 64bit version of the main application if available
  • create, copy, move and delete files, directories, registry keys and values
  • various checks: admin rights, multiple instance, OS version, .NET, Java and internet connection
  • request admin mode if admin mode is required
  • execute batch files
  • import and export registry keys
  • merge reg files
  • read and write ini files
  • replace strings or lines in text files
  • set environment variables
  • show custom messages
  • run applications
  • create symlinks (requires NTFS file system)
  • register and unregister dll files
  • environment variable and shell folder expansion
  • path, date, text and language macros
  • set file and directory attributes
  • encrypt config items using yaPcrypt
  • refresh system shell icons
  • kill processes
  • put text on clipboard
  • clean "MuiCache" and "App Paths" values from registry on close
  • small executable size and memory usage
  • 100+ example configurations

Usage

Before start, examine the application you are about to portablize and find out where does it store settings, how deeply integrates to the system, etc. This is necessary to be able to tell yaP what directories, files, registry keys to take care of.

Follow these steps to create a new yaP launcher:

  1. Create a new directory ( MyApp ) and put application's files to a subdirectory (e.g MyApp\App ).
    Use Universal Extractor to get application files if it is an installer or install & uninstall if other methods fail.

  2. Copy yaP.exe to MyApp directory and rename it to a custom name (eg. MyAppPortable.exe ).

  3. Run MyAppPortable.exe and click Ok to generate a new yaP settings file ( MyAppPortable.ini ).

  4. Edit MyAppPortable.ini and fill the necessary fields.

    • add main application's exe path (eg. application = App\MyAppName.exe )
    • list files, directories, registry keys or values to portablize

    Refer to the configuration section for ini syntax or check the examples for ready-made configurations.

  5. Run MyAppPortable.exe

Note: if your portable needs advanced logic you can execute custom batch files with yaP.

Download yaP

Download yaP v0.7.1  |  120 KB  |  2016-09-26

Downloaded 5645 times since 05/2013

yaPcrypt (more info)

Download yaPcrypt (39 KB)

License

yaP is free. You can use, distribute and modify as you like it. The author is not liable for any damages arising from its use.

Disclaimer

yaP is provided "as is" and "with all faults." The developer makes no representations or warranties of any kind concerning the safety, suitability, lack of viruses, inaccuracies, typographical errors, or other harmful components of yaP. There are inherent dangers in the use of any software, and you are solely responsible for determining whether yaP is compatible with your equipment and other software installed on your equipment. You are also solely responsible for the protection of your equipment and backup of your data, and the developer will not be liable for any damages you may suffer in connection with using, modifying, or distributing yaP.

Version History

Read the full yaP changelog here.

yaPcrypt

From v0.34 it is possible to add encrypted text to config files. The purpose is to avoid sensitive data in plain text format (passwords, file paths, etc).

Example:
commandline=!@@DzwUOTICZidVHBEGIRgdXw5sISM3Ii87Vi9OKTMVGFMNYRNoPRAXATs6WDJaCh41ODkVBw5pEyM3IiM/V3JOajVhPgoeU0E9AA==

This is the encrypted equivalent of
commandline="d:\mySensitiveData.file" -pw:"myPassword"
using the password "admin".

If a password is used during encryption, yaP will launch the main application only if the valid password is entered. This means that you can add password protection to the launcher by encrypting a config item value, eg. the main application path. Encrypted values without passwords are to hide information without password prompt.

How to encrypt config items with yaPcrypt

  • set up your config file as usual
  • copy a value you need to encrypt to the clipboard
  • launch yaPcrypt and paste the plain text value
  • if you need password protection then type in a password
  • replace value in the config file with encrypted text

If you need to modify the config value later, simply decrypt it with yaPcrypt, then modify and encrypt again.

yaPcrypt instructions

  • encrypt the whole value of a config item instead of only parts of it
  • multiple encrypted items in config files are allowed but the same password should be used (or no password at all)
  • passwords are case sensitive
  • maximum password length is 20 characters

A word on security

There is no 100% secure encryption available and neither is yaPcrypt an exception.
However, choosing a proper password will make decoding impossible for the average human beings.

Please note that even if you launch the main application with encrypted commandline parameters, yaP will pass unencrypted data to the application which may be visible to other applications.

Example configurations

Configuration

Ini sections

  • GENERAL: contains application path, commandline parameters and working directory, plus initial system checks
  • BEFORE: items that are run before launching the main application
  • AFTER: items that are run after closing the main application
  • QUICK REFERENCE: a help section to provide an overview of the available items

Structure of the items

  • Items consist of keyword-value pairs. Values may contain several segments separated with the " :: " delimiter.
  • If a segment needs to be skipped set its content to "NULL". Optional segments are indicated with square brackets.
  • Items can be commented out with the ";" character. Comments are skipped by yaP.

keyword = segment1 config item with one segment keyword = segment1 :: segment2 :: segment3 item with three segments keyword = segment1 :: NULL :: segment3 item with three segments (second segment is empty) keyword = segment1 [ :: segment2] item with an optional second segment ; keyword = segment1 commented item, not processed

Order of the items

The first item should always be "application" in the GENERAL section. The order of the items are arbitrary otherwise.
Some keywords are restricted to BEFORE or AFTER sections, these are indicated below. Keywords in wrong sections are skipped.

Paths

Paths can be absolute or relative to the launcher. No need to add quotes around them if they contain spaces.
Environment variables, shell folders and yaP macros can also be used when constructing paths.

Keywords

Keywords to use in the GENERAL section

application

application = Application path application = C:\Dir\App.exe :: ..\Dir\AppX64.exe application = %ProgramFiles%\App.exe :: %ProgramFiles%\AppX64.exe

Path of the main application to run. Required.

On a 64bit OS yaP automatically launches the application set in the second segment (if available).

commandline

commandline = Commandline parameters commandline = /nosplash commandline = --dir="{YAPROOT}\Settings"

Commandline parameters to pass to the main application.

workdir

workdir = Directory path workdir = C:\MyApp workdir = %Appdata%\MyApplication

Working directory of the main application.

Defaults to the main application's directory if not specified otherwise.

!admin

!admin = 1 start the launcher in admin mode !admin = 2 show a message if user is not admin and quit !admin = -1 quit if user is not admin (no message)

Indicate that admin rights is required for the main application to run.

!dotnet

!dotnet = 4.0 !dotnet = 2.1!

Notify the user if the specified .NET version is needed to run the main application and is not available on the host machine.

Use an exclamation mark to exit if the specified version is not available.

!java

!java = 1.6 !java = 1.7!

Notify the user if the specified Java version is needed to run the main application and is not available on the host machine.

Use an exclamation mark to exit if the specified version is not available.

!multiple

!multiple = 1 always enable multiple instances (no prompt) !multiple = 2 run the main application without BEFORE and AFTER items !multiple = -1 always disable multiple instances (no dialog)

Enable or disable multiple instances of the main application.

If not specified otherwise yaP asks whether to launch another instance.

!online

!online = 1 ask to continue (if offline) !online = 2 show a dialog box that online connection is required (if offline) !online = -1 quit without prompt (if offline) !online = -2 ask to continue if offline status is required (if online) !online = -3 show a dialog box that offline status is required (if online)

Notify the user that internet connection is required for the main application if offline (or vice versa).

!os

!os = XP the main application requires Windows XP or newer !os = Vista the main application requires Windows Vista or newer !os = <7 the main application requires Windows 7 or older !os = 8 the main application requires Windows 8 or newer

Notify the user if the current OS version does not meet the main application's minimum or maximum OS requirement.

Use the "<" character to indicate the max OS version.

!waitprocess

!waitprocess = Full or partial process title !waitprocess = - Notepad++ wait for all apps to close having "- Notepad++" in title

(Partial) title of a process that should be closed before executing AFTER items.

Some applications are only launchers to other applications and in these cases yaP would fire AFTER items right after closing the main app. By specifying a process to wait it is possible to run AFTER items only when the process terminates.

  • The value can be the full title of a process window or only part of it. Be careful not adding too generic values.
  • All matching processes should be closed to start executing AFTER items.

Keywords to use in BEFORE and AFTER sections

dir BEFORE section only

dir = Source directory path :: Target directory path dir = C:\Dir :: SubDir dir = C:\Dir Settings subdirectory will be used as target directory

Backup, save and restore contents of a directory.

If target directory is missing the "Settings" subdirectory of the launcher will be used.

Operations on BEFORE run:

  1. backup directory "C:\Dir" to "C:\Dir_backup"
  2. create directory "C:\Dir"
  3. copy contents of directory "{YAPROOT}\SubDir" to "C:\Dir"

Operations on AFTER run:

  1. copy contents of directory "C:\Dir" to "{YAPROOT}\SubDir"
  2. delete directory "C:\Dir"
  3. restore directory "C:\Dir_backup" to "C:\Dir"

file BEFORE section only

file = Source file path :: Target file or directory path file = %Appdata%\MyFile.ini :: SubDir\MyFile.ini file = C:\Dir\MyFile.ini :: SubDir\ file = C:\Dir\MyFile.ini launcher directory will be used as target directory

Backup, save and restore a file.

  • If the target file or directory is missing the launcher directory will be used.
  • If the target is a directory it must be indicated with a trailing backslash ("\").

Operations on BEFORE run:

  1. backup file "C:\Dir\MyFile.ini" to "C:\Dir\MyFile.ini_backup"
  2. copy file "{YAPROOT}\SubDir\MyFile.ini" to directory "C:\Dir"

Operations on AFTER run:

  1. move file "C:\Dir\MyFile.ini" to directory "{YAPROOT}\SubDir"
  2. restore file "C:\Dir\MyFile.ini_backup" to "C:\Dir\MyFile.ini"

regkey BEFORE section only

regkey = Source registry key :: Target registry export file or target directory path regkey = HKCU\Software\RegKey :: SubDir\settings.reg regkey = HKCU\Software\RegKey :: settings.reg regkey = HKCU\Software\RegKey :: SubDir\ save reg key to {YAPROOT}\SubDir\settings.reg regkey = HKCU\Software\RegKey save reg key to {YAPROOT}\settings.reg

Backup, save and restore a registry key.

  • If the target registry export file is missing the registry key will be exported to settings.reg to the launcher's root directory.
  • If target is a directory it must be indicated with a trailing backslash "\".

Operations on BEFORE run:

  1. backup regkey "HKCU\Software\RegKey" to "HKCU\Software\RegKey_backup"
  2. import file "settings.reg" to the registry

Operations on AFTER run:

  1. export regkey "HKCU\Software\RegKey" to "settings.reg"
  2. delete regkey "HKCU\Software\RegKey"
  3. restore regkey "HKCU\Software\RegKey_backup" to "HKCU\Software\RegKey"
  4. delete empty parent regkeys if regkey is a subkey of "HKCU\Software" or "HKLM\Software"

regvalue BEFORE section only

regvalue = Source registry value :: Target registry export file or target directory path regvalue = HKCU\Software\Key\Value :: SubDir\settings.reg regvalue = HKCU\Software\Key\Value :: settings.reg regvalue = HKCU\Software\Key\Value :: SubDir\ save value to {YAPROOT}\SubDir\settings.reg regvalue = HKCU\Software\Key\Value save value to {YAPROOT}\settings.reg

Backup, save and restore a registry value.

  • If the target registry export file is not set the registry value will be exported to settings.reg to the launcher's root directory .
  • If target is a directory it must be indicated with a trailing backslash "\".
  • Only "REG_SZ" and "REG_DWORD" value types are supported.

Operations on BEFORE run:

  1. backup reg value "HKCU\Software\Key\Value" to "HKCU\Software\Key\Value_backup"
  2. import file "settings.reg" to the registry

Operations on AFTER run:

  1. export reg value "HKCU\Software\Key\Value" to "settings.reg"
  2. delete reg value "HKCU\Software\Key\Value"
  3. restore reg value "HKCU\Software\Key\Value_backup" to "HKCU\Software\Key\Value"
  4. delete empty parent regkeys if regkey is a subkey of "HKCU\Software" or "HKLM\Software"

(dir) BEFORE section only

(dir) = Directory path (dir) = C:\Dir

Backup and restore a directory.

Operations on BEFORE run:

  1. backup directory "C:\Dir" to "C:\Dir_backup"

Operations on AFTER run:

  1. restore directory "C:\Dir_backup" to "C:\Dir"

(file) BEFORE section only

(file) = File path (file) = C:\Dir\MyFile.ini

Backup and restore a file.

Operations on BEFORE run:

  1. backup file "C:\Dir\MyFile.ini" to "C:\Dir\MyFile.ini_backup"

Operations on AFTER run:

  1. restore file "C:\Dir\MyFile.ini_backup" to "C:\Dir\MyFile.ini"

(regkey) BEFORE section only

regkey = Registry key regkey = HKCU\Software\RegKey

Backup and restore a registry key.

Operations on BEFORE run:

  1. backup regkey "HKCU\Software\RegKey" to "HKCU\Software\RegKey_backup"

Operations on AFTER run:

  1. delete regkey "HKCU\Software\RegKey"
  2. restore regkey "HKCU\Software\RegKey_backup" to "HKCU\Software\RegKey"
  3. delete empty parent regkey(s) if regkey is a subkey of "HKCU\Software" or "HKLM\Software"

(regvalue) BEFORE section only

(regvalue) = Registry value (regvalue) = HKCU\Software\Key\Value

Backup and restore a registry value.

Only "REG_SZ" and "REG_DWORD" registry value types are supported.

Operations on BEFORE run:

  1. backup reg value "HKCU\Software\Key\Value" to "HKCU\Software\Key\Value_backup"

Operations on AFTER run:

  1. delete reg value "HKCU\Software\Key\Value"
  2. restore reg value "HKCU\Software\Key\Value_backup" to "HKCU\Software\Key\Value"
  3. delete empty parent regkey(s) if regkey is a subkey of "HKCU\Software" or "HKLM\Software"

->dir

->dir = Source directory path [ :: Target directory path] [ :: move, no overwrite] ->dir = %Temp%\Dir :: SubDir copy contents of %Temp%\Dir to {YAPROOT}\SubDir <-dir = %Temp%\Dir :: SubDir :: move move contents of {YAPROOT}\SubDir to %Temp%\Dir ->dir = C:\Dir :: C:\Dir_old :: no overwrite backup dir to C:\Dir_old (copy, skip existing) <-dir = C:\Dir :: C:\Dir_backup :: move restore dir C:\Dir_backup to C:\Dir (move) ->dir = %Desktop%\OldDir :: %Desktop%\NewDir :: move rename OldDir to NewDir on Desktop

Copy or move contents of a directory to another directory.

  • Use "<-dir" keyword to reverse direction.
  • Use the "move" flag to move directory contents instead of copy. After moving the source directory is deleted.
  • Use the "no overwrite" flag to skip operation if the target already exists.
  • To rename a directory move directory contents to a different directory on the same path.
  • An empty target directory (NULL) defaults to "Settings" subdirectory of the launcher.
  • If source and target are equal no operation will be done.

->file

->file = Source file path [ :: Target file or directory path] [ :: move, no overwrite] ->file = C:\File.ini :: Dir copy C:\File.ini to {YAPROOT}\Dir ->file = C:\File.ini :: Dir\File.ini :: move move C:\File.ini to {YAPROOT}\Dir <-file = C:\File.ini :: Dir\File.ini :: move move {YAPROOT}\Dir\File.ini to C:\ ->file = %Appdata%\settings.xml copy %Appdata%\settings.xml to launcher directory <-file = C:\a.7z :: NULL :: no overwrite copy {YAPROOT}\a.7z to C:\, skip existing ->file = File.txt :: Todo.txt :: move rename File.txt to Todo.txt

Copy or move a file.

  • Use "<-file" keyword to reverse direction.
  • Use the "move" flag to move file instead of copy. After moving the source file is deleted.
  • Use the "no overwrite" flag to skip operation if the target already exists.
  • If target is a directory then the target filename will be the same as the source filename.
  • If target is a directory it must be indicated with a trailing backslash "\".
  • To rename a file move file to a different filename on the same path.
  • An empty target (NULL) defaults to launcher root directory.
  • If source and target are equal no operation will be done.

->regkey

->regkey = Source registry key :: Target registry key [ :: move] ->regkey = HKCU\Software\A :: HKCU\Software\B copy contents of regkey A to B <-regkey = HKCU\Software\A :: HKCU\Software\B :: move move contents of regkey B to A ->regkey = HKCU\Software\OldKey :: HKCU\Software\NewKey :: move rename regkey

Copy or move contents of a registry key to another registry key.

  • Use "<-regkey" keyword to reverse direction.
  • Use the "move" flag to move registry key contents instead of copy. After moving the source key is deleted.
  • To rename a registry key move key contents to a different key under the same key.
  • If the target registry key is empty or source and target are equal no operation will be done.

->regvalue

->regvalue = Source registry value :: Target registry value [ :: move] ->regvalue = HKCU\Software\Key\A :: HKCU\Software\Key\B copy value of A to B <-regvalue = HKCU\Software\Key\A :: HKCU\Software\Key\B :: move move value of B to A ->regvalue = HKCU\Software\Key\OldValue :: HKCU\Software\Key\NewValue :: move rename value

Copy or move contents of a registry value to another registry value.

  • Use "<-regvalue" keyword to reverse direction.
  • Use the "move" flag to move registry value instead of copy. After moving the source value is deleted.
  • To rename a registry value move value to a different value under the same key.
  • If the target registry value is left empty or source and target are equal no operation will be done.
  • Only "REG_SZ" and "REG_DWORD" value types are supported.

+dir

+dir = Directory path +dir = C:\Dir

Create a new directory.

+file

+file = File path [ :: overwrite | no overwrite] [ :: file contents] +file = C:\Dir\MyFile.ini +file = C:\Dir\MyFile.ini :: overwrite :: Hello world +file = C:\Dir\MyFile.ini :: no overwrite :: [SETTINGS]{LINEBREAK}update=0

Create a new file.

If the "no overwrite" flag is present the file will not be created if already exists.
File contents can be set in the third segment.

+regkey

+regkey = Registry key +regkey = HKCU\Software\RegKey

Create a new registry key.

+regvalue

+regvalue = RegKey :: RegValueName :: RegValueData :: DataType :: RegSeparator +regvalue = HKCU\Software\MyApp :: Language :: English +regvalue = HKCU\Software\MyApp :: FirstStart :: 0 :: REG_DWORD

Create a new registry value.

  • RegKey is the registry key where the value will be added.
  • RegValueName is the name of the registry value to be added.
  • RegValueData is the data to add to RegValueName. To add default data, leave the RegValueData empty. Note that you have to supply valid data for the selected datatype to work.
  • DataType is the type of the RegValueData. Defaults to REG_SZ if missing.
    Options: REG_SZ, REG_MULTI_SZ, REG_EXPAND_SZ, REG_DWORD, REG_QWORD, REG_BINARY
  • RegSeparator is the separator for datatype REG_MULTI_SZ. Not needed for other types.

-dir

-dir = Directory path [ :: ifempty] -dir = %Appdata%\Dir -dir = C:\Dir :: ifempty delete C:\Dir only if it contains no files or subdirectories -dir = %Temp%\cache-* delete all directories from %Temp% that starts with "cache-"

Delete directory or directories.

  • Wildcard characters "?" and "*" are allowed in directory names.
  • If the "ifempty" flag is present, yaP will delete the directory only if the directory is empty.

-file

-file = File path -file = C:\Dir\MyFile.ini -file = %Temp%\*log* delete all files from %Temp% that contains with "log"

Delete file or files.

Wildcard characters "?" and "*" are allowed in filenames.

-regkey

-regkey = Registry key [ :: ifempty] -regkey = HKCU\Software\RegKey -regkey = HKCU\Software\RegKey :: ifempty

Delete a registry key.

If the "ifempty" flag is present, yaP will delete the registry key only if the key is empty.

-regvalue

-regvalue = Registry key :: Registry value name -regvalue = HKCU\Software\MyApp :: Lang

Delete a registry value.

attributes

attributes = File or directory path [ :: attributes separated with commas] attributes = C:\Dir :: system attributes = MyFile.ini :: readonly, hidden set MyFile.ini to readonly and hidden attributes = ..\MyFile.ini set MyFile.ini to normal in parent directory

Set directory or file attributes.

  • Separate multiple items with commas.
  • Available attributes: archive, compressed, hidden, normal, readonly, system
  • If no attribute is supplied the attribute defaults to "normal"
  • Setting directory attributes is not recursive, directory content attributes will not be modified.

batch

batch = C:\before.bat batch = SubDir\before.bat :: show

Execute a batch file.

  • If the "show" flag is present, the cmd window will show until the launcher exits.
  • Add "PAUSE" to the end of the batch file to keep it open after exit.

clip

clip = Text or empty clip = Hello world! puts Hello World! on clipboard clip = *EMPTY* set clipboard empty

Text to put on clipboard.

Set its value to "*EMPTY*" to clear clipboard.

date

date = File [ :: Date] [ :: Date type] date = New.7z :: 2013.12.31 23:59 :: modified set New.7z date modified to 2013.12.31 23:59 date = File.txt :: now :: accessed set File.txt date accessed to current system date date = File.txt set File.txt date modified to current system date

Set file date.

  • Date: date formatted as "%yyyy.%mm.%dd %hh:%ii:%ss". If missing, defaults to system date.
    Setting date to "now" also sets date to current system date.
  • Date type: "created", "accessed" or "modified". Defaults to "modified" if empty.

delay

delay = 500

Milliseconds to wait before executing the next item in the config file.

envvar

envvar = LANG :: English

Set environment variable. It will be visible for the main application and its child processes only.

iniread

iniread = IniFile :: [Section] :: Key :: User variable iniread = File.ini :: SETTINGS :: Lang :: MyVar read Lang key value to variable MyVar iniread = File.ini :: NULL :: Lang :: MyVar read Lang key value to MyVar (no section)

Read a value from an ini file and save it to a user variable.

Leave the Section segment empty to read a key that is outside a section.
The new variable can be used as "{MyVar}" later on.

iniwrite

iniwrite = IniFile :: [[--]Section] :: Key [ :: Value] iniwrite = Dir\File.ini :: SETTINGS :: Lang :: EN write Lang=EN to SETTINGS section iniwrite = Dir\File.ini :: SETTINGS :: Lang remove Lang key from SETTINGS section iniwrite = Dir\File.ini :: --SETTINGS delete SETTINGS section

Write a key-value to an ini file.

  • If the Value segment is empty then the Key will be removed.
  • Leave the Section segment empty to write a key without an ini section.
  • If the Section name starts with "--" the entire section will be deleted.

killprocess

killprocess = Process name killprocess = Notepad.exe killprocess = Notepa*

Terminate all instances of the specified process.

The "*" character can be used as a wildcard at the end of the process name.

message

message = Text [ :: cancellable] message = Hello world! message = Commandline is: {COMMANDLINE} :: cancellable

Show a topmost dialog box with the specified message.

  • The launcher waits until the dialog box is closed.
  • No message is shown if the supplied text is empty.
  • If the "cancellable" flag is used, the dialog will have an extra "Cancel" button mainly for testing purposes.
    Note that cancelling the message the launcher will quit so no AFTER items will be executed.

nowait

nowait = 1

Quit after launching the main application without executing AFTER items.

quit

quit = 1

Terminate the launcher.

  • No AFTER items will be executed. The main application will not be terminated if it has been already launched.
  • By using "quit" in the BEFORE section it is possible to execute items without launching the main application.

regdll

regdll = Dll file path [ :: unregister] regdll = Dir\Library.dll regdll = Dir\Library.dll :: unregister

Register or unregister a dll file.

Note that admin rights may be required for this operation.

regexport

regexport = Registry key or value [ :: Target file or directory path] regexport = HKCU\Software\App\ :: C:\Dir\reginfo.reg regexport = HKCU\Software\App\ :: Dir\reginfo.reg export key to {YAPROOT}\Dir\reginfo.reg regexport = HKCU\Software\App\ :: Settings\ export key to {YAPROOT}\Settings\settings.reg regexport = HKCU\Software\App\ export key to {YAPROOT}\settings.reg regexport = HKCU\Software\App\Lang export value to {YAPROOT}\settings.reg

Export a registry key or value to file.

  • If the target file is not set the registry key will be exported to settings.reg to the launcher's root directory.
  • If the source is a registry key it must be indicated with a trailing backslash "\".
  • If the target is a directory it must be indicated with a trailing backslash "\". The registry key will be exported to "settings .reg" to the specified directory.
  • Exporting registry values: only "REG_SZ" and "REG_DWORD" types are supported.

regimport

regimport = RegFile.reg regimport = Dir\reginfo.reg

Import a registry file to the registry.

regmerge

regmerge = RegFile.reg :: RegFile.reg regmerge = Settings\settings.reg :: Settings\anotherfile.reg

Merge two reg files into one.

The contents of the second reg file will be appended to the first reg file.

replace

replace = File :: StringToFind :: Replacement replace = C:\MyFile.txt :: "hello" :: "hi"

Replaces all occurences of StringToFind with Replacement in a file.

replaceline

replaceline = File :: Beginning of line to find :: Replacement replaceline = Settings.xml :: <checkForUpdates :: <checkForUpdates value="0"/>

Replaces the first matching line with the Replacement in a file.

restore AFTER section only

restore = 1

Indicates when should yaP run automatic AFTER items.

When using keywords "dir", "file", "regkey", "(dir)", "(file)", "(regkey)" and "symlink" yaP automatically adds their AFTER operations to the processing queue. By default these items are run right after closing the main application. If the "restore" keyword with value 1 is present then yaP will run these items where this keyword is found in the list.

run

run = Application [ :: wait] [ :: commandline parameters] [ :: working directory] run = %Windir%\Notepad.exe :: wait :: C:\MyFile.txt :: {YAPROOT} run = %Windir%\Notepad.exe :: NULL :: C:\MyFile.txt :: {YAPROOT} run = %Windir%\Notepad.exe

Run an application.

If the "wait" flag is used yaP will wait for the application to terminate before processing the next config item.

stringreplace

stringreplace = Text :: String to find :: Replacement :: User variable stringreplace = {YAPROOT} :: \ :: // :: MyVar replace all "\" to "//" in {YAPROOT} stringreplace = %Desktop% :: \ :: NULL :: MyVar remove all "\" from %Desktop%

Search and replace string in a string and save the result to a user variable.

The new variable can be used as "{MyVar}" later on. An existing user variable will be overwritten.

symlink BEFORE section only

symlink = Link: file or directory path :: target file or directory path symlink = %Appdata%\MyDir\ :: Settings\MyDir\ symlink = %Appdata%\MyFile.ini :: Settings\MyFile.ini

Create a directory or file symbolic link.

  • Directory paths must be indicated with a trailing backslash "\".
  • The symlink is removed when the launcher terminates.
  • Note that admin rights and NTFS filesystem is needed to successfully create a symlink. yaP checks for admin rights but not for NTFS filesystem.

systemrefresh

systemrefresh = 1

Refresh the system.

uservar

uservar = Variable name :: Variable value uservar = MyRegKey :: HKCU\Software\MyApp

Add a custom user variable.

  • Once added, it can be referenced using curly braces, eg. "{MyRegKey}".
  • Adding a user variable with the same name will overwrite existing.

Variables and macros

Path macros

{YAPROOT} absolute path of the launcher's directory
{EXEPATH} absolute path of the main application's directory
{APPEXE} absolute path of the main application
{DRIVE} current drive letter of the launcher, eg. "D"
{USERFILE} browse file dialog to dynamically add filepath
{USERDIR} browse directory dialog to dynamically add path
{WORKDIR} working directory of the main application

Text macros

{CLIPBOARD} text on clipboard
{LINEBREAK} new line
{USERTEXT} text input dialog to dynamically add text

Date and time macros

{d} day of the month, 2 digits with leading zeros
{j} day of the month without leading zeros
{m} numeric representation of a month, with leading zeros
{n} numeric representation of a month, without leading zeros
{Y} a full numeric representation of a year, 4 digits
{y} a two digit representation of a year
{g} 12-hour format of an hour without leading zeros
{G} 24-hour format of an hour without leading zeros
{h} 12-hour format of an hour with leading zeros
{H} 24-hour format of an hour with leading zeros
{i} minutes with leading zeros
{s} seconds, with leading zeros
{U} seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)

Language and locale macros

{LANG} "English"
{LOCALE} "EN"
{LOCALENAME} "en-GB"
{LOCALENAME_SHORT} "en"
{COUNTRY} "United Kingdom"

Misc macros

{COMMANDLINE} parameters passed to the main application
{PARAMETERS} parameters passed to the launcher

User-defined variables

See keyword "uservar".

Shell folders

%Administrative Tools% %Cache% %CD Burning% %Cookies% %Desktop% %Documents% %Favorites% %Fonts% %History% %Local Appdata% %MyDocuments% %My Music% %My Pictures% %My Video% %NetHood% %Personal% %PrintHood% %Programs% %Recent% %SendTo% %Start Menu% %Startup% %Templates%

Environment variables

See the Wikipedia page for the complete list of environment variables.


Frequently Asked Questions

I don't understand a thing.
Though yaP is intended to be easy to use it is not for beginners. If you are looking for ready-made portable applications visit The Portable Freeware Collection, Lupo PenSuite, PortableApps.com, LiberKey, WinPenPack or other portable collection sites.

How can I update yaP-ped portables?
Manually update main application files even if an auto update feature is available. Otherwise the main application may restart itself and leave settings in the system. Also check whether the new version saves settings to the same locations - if not, change the configuration ini accordingly.

Is there any directory structure convention to follow?
Nope. yaP needs only the config file (LauncherName.ini or yaP.ini) to be next to the launcher exe. Application and settings files can be anywhere.

How can I change yaP.exe icon?
Use a 3rd party software, eg. QIcon-Changer.

Is yaP PortableApps format compatible?
yaP is not designed to be compatible with PA but creating the extra dirs/files that PA requires it can be done.

Can I use UPX to further reduce the launcher size?
Yes, but keep in mind that some AV software may flag it as malicious.

Can I use "HKCU" and "HKEY_CURRENT_USER" interchangeably?
Yes, just like "HKLM" and "HKCR" as well.

Can yaP show a splash screen?
No.

Will yaP create a directory if the parent directory is not available?
Yes, yaP creates a directory tree.

Can I use "..\" or nested directories in paths?
Yes. "+file = ..\Subdir1\Subdir2\MyFile.txt" will work.

What programming language is yaP written in? Is the source code available?
yaP is written in PureBasic. The source code is not available yet.

Where can I submit a new example configuration or report a bug?
Visit the yaP forum topic at The Portable Freeware Collection or use the discussion section below.

Discussion

comments powered by Disqus


© 2017 rolandtoth