A portable application can be run from a removable drive (USB flash drive, iPod, portable hard drive, etc) on any Windows computer without installation.
You will carry the program with settings on removable drive and don't modify settings on host computer.
On Vista and above turn off User Account Control (UAC) or run launcher as admin.

If you found dead links, search on Jooseng's Mirrors.

03 May 2009


A little Tutorial trying to explain how to compile launchers for portable with NSIS.
Post your questions here.
Tutorial mirror


Thanks to KursadOlmez and Anthony for hosting.

Portable Total Uninstall 4.10 Multilingual 1.4 MB

80 commentaires:

thierry said...

beau cadeau ca !!! j'y plonge directement !
merci bernat c'est extra ! @+

piroshok said...

Great! Fantastic I have been waiting for an opportunity to assist you if I can with your release bernat

piroshok said...

Great! I was waiting for an opportunity to make and share portables

peter said...

love this site, love this site's author :X

Alexei said...

Thank you for all your work Bernat.
You are now portable maker and teacher.
If I have a question, I write it on this page.

Alexei

adhem said...

merci bernat c'est super
merçi de partager ton savoir faire et surtout merçi pour ton super blog

Faiakes said...

Merci Bernat, finally a good guide.

Fraz said...

Nice work!!!I hope make Gom Player portable and then i'll give you it!! Very good as ever!!

dan said...

I love this site, thanks for everything you do!!!
If you can put in any application, the sources.
thanks again.

JVP said...

O melhor site de sofwares que existe. parabéms

do Brasil.

Roberto said...

Excuse me bernat,but whrei can find the guide?
P.S. Thanks for your softwares.

Roberto said...

Hi Bernat thank you very miuch for your nices application.
A question: where i can find the tutorial?
Bye

GrzegorzJZD said...

Tutorial localization is dead. There is no way to open it. Could You upload it as PDF?

http://www.htm2pdf.co.uk

Anthony said...

@ Bernat ... firstly, thanks for all your great portables, I love 'em ... secondly, I uploaded the tutorial etc to my webspace.
It's here: http://www.oztroll.com/portableappz/

Bernat said...

Many thanks Anthony!

I am very happy to see my tut online again.

For update I will mail to your controll.

KursadOlmez said...

Hi Bernat,

I really appreciate and thank to you for obtaining many useful programs to Portable.

I want to host your personal site in my hosting server. I uploaded your files to http://portableappz.proxima.web.tr

I can give you a FTP access to that subdomain and you can upload your files at any time.

Please send me an email if you want to access with FTP Client and I will send you the informations.

Thank you again.

Bernat said...

Many thanks also KursadOlmez,

I am very interested to an FTP access for updates but your profile is not available, so I can't mail you. You can click on my pseudo to see my mail.

Fraz said...

Nice work Boyz!!This site is one the bewst i ever seen..It will never DIE!!Thanks a lot Bernat ;)

KursadOlmez said...

Opps, I forgot to activate my blogger profile :)

I send you an email about FTP.

Fraz said...

This is too much complicated for me!!This tutorial rocks but is too difficult for my computer knowledges..Any of you can explain me how to make Gom Player or Perfect Disk portables with this procedure??Thanks in advance..

Bernat said...

Try with ThinApp.

dan said...

All Users question in backup folder??

what is the variable to difine APPDATA in
C:\Documents and Settings\ALL USERS\APPDATA
-------------------------------------------------
The default is THE CURRENT USER. C:\Documents and Settings\Users\($APPDATA)

Bernat said...

It is the same constant $APPDATA but changing of value with SetShellVarContext (before)

SetShellVarContext current (default: not to be set)
$APPDATA return:
C:\Documents and Settings\Bernat\Application Data (XP)
or
C:\Users\Bernat\AppData\Roaming (Vista)

SetShellVarContext all
$APPDATA return:
C:\Documents and Settings\All Users\Application Data (XP)
or
C:\ProgramData (Vista)

dan said...

thanks bernat, you could do a detailed example in NSIS code to better understand?

thanks again.

Bernat said...

What is the path of the folder you want to backup?

dan said...

is: C:\Documents and Settings\All Users\Dati applicazioni\{067CEB81-A49B-4597-9505-A5515881D672}

the name of the program is Stardock Fences.

Bernat said...

; Only part of codes using MyProgPortable_Lite.nsi

; ---Define Local Dirs and Portable Dirs ---
!define LOCALDIR1 "$APPDATA\{067CEB81-A49B-4597-9505-A5515881D672}"
!define PORTABLEDIR1 "$EXEDIR\Data\Stardock"

; SetShellVarContext only in first function used for dirs
Function BackupLocalDirs
SetShellVarContext all
RMDir "/r" "${LOCALDIR1}-BackupBy${APP}Portable"
Rename "${LOCALDIR1}" "${LOCALDIR1}-BackupBy${APP}Portable"
FunctionEnd

;If the program only create one foder in Dati applicazioni, otherwise: !define LOCALDIR2 etc.

Fraz said...

Thanks Bernat but 2 of my favourites programs wouldn't work with ThinApp (GomPlayer and Perfect Disk). So this procedure i hope works.. but i can't do this because of my poor knowledges ;)

William said...

Bernat, how would someone manipulate your launcher so that it does not display your splash screen? I fully understand that the .ini file could be manipulated by setting the DisplaySplashScreen=True but sometimes, if the portable is not too big, I will RAR all the files into one exe file and run it that way; however, when doing this, the splash screen will still appear as the ini file does not hold its setting after all files have been RAR'd into one exe. Is there a solution to what I want to do?

Bernat said...

No solution: I don't want my portables shared splash disabled (I want user know origin).

"RAR all the files into one exe file and run it that way" is a bad use if you extract every time silently in temp: you don't keep settings.

Sometimes I saw on the web my portables packed in this stupid way.

William said...

I do not change the structure which you have put in place when I RAR files. Everything extracts the same exact way when I RAR files; however, I do understand what you are saying. You may not be a big fan of RAR, but that does not mean that I am stupid for using it in the manner in which I do. I personally try to use better grammar when communicating with someone; regardless of their origin or location.

Bernat said...

Sorry, it's difficult for me to write in english.
The "stupid" was for those who share my portables in sfx RAR (someting_portable_by_myself) extracting silently in temp and splash disabled in ini.
This was not of course for you.

Splash reappears if you change path of portable but still disabled if you only change drive letter (plug USB on another computer).

dan said...

Thanks Bernat for the help,i understand.

Last help please,

the variable to define C:\Documents and Settings\dan\Impostazioni locali\Dati applicazioni

what is?

Bernat said...

This is $LOCALAPPDATA
(either current or all)

dan said...

Thanks again Bernat!! your help is gold!!

Bernat said...

Added at the end of the tut the script of and exe to write the values of all NSIS constants in an ini file.
Added also missing links to Registry and FindProc.

dan said...

This is a very good job Bernat!!

everything is now easier.

Thanks AGAIN!!!

واحد موحد said...

THank you Very much . I wait for this for along time . thanks

dan said...

Now that i remember, i have noticed that there is no code for the: SplashScreenName=

you could tell me what is the code to be included in NSIS for SplashScreenName=

thanks in advance Bernat.

Bernat said...

Minor customization, just compile with the splash of your choice.

happyasr said...

hey man thanks for this info

Bernat said...

WinUe Sigue said...
I made several programs based on your tutorial. Work well, but note that it has a considerable delay. Open quickly, but that the hourglass indicates that the process is not completed, it remains there for several seconds. For example, I got the "My Drivers" here: http://rapidshare.com/files/231165600/MD.RAR.html
Any error code?

No error code, with NSIS launchers cursor is busy few seconds but you can use program.

About MyDrivers, should be better backup MyDrivers.ini in Data and also backup-restore registry key and files of an installed MyDrivers.

A minimal script:
;--- Start MyDriversPortable.nsi ---
WindowIcon Off
SilentInstall Silent
AutoCloseWindow True
OutFile MyDriversPortable.exe
Section
FileOpen $0 "$WINDIR\system.sys" w
FileClose $0
WriteRegStr HKEY_CURRENT_USER "Software\Microsoft\Windows\CurrentVersion\IPSec" "RISCx86" "02/01/1900 18:00:00"
WriteRegStr HKEY_CURRENT_USER "Software\Microsoft\Windows\CurrentVersion\IPSec" "DriverUpdate" "02/01/1900 18:00:00"
WriteRegStr HKEY_CURRENT_USER "Software\Microsoft\Windows\CurrentVersion\IPSec" "UserName" "your_name_here"
ExecWait "$EXEDIR\App\MyDrivers\MyDrivers.exe"
DeleteRegKey HKEY_CURRENT_USER "Software\Microsoft\Windows\CurrentVersion\IPSec"
Delete $WINDIR\MyDrivers.ini
Delete $WINDIR\system.sys
SectionEnd
;--- End MyDriversPortable.nsi ---

WinUe Sigue said...

This "cursor is busy few seconds" disappears if we add the splashscreen (with schowtime = 0).
For example:

Function .onInit
SetOutPath $TEMP
File /oname=spltmp.bmp "ar.bmp"
advsplash::show 0 600 400 -1 $TEMP\spltmp
Pop $0
FunctionEnd

Appears to be an annoying bug of NSIS.
It should not happen, because when the program was completed run "ExecWait "$EXEDIR\..\MyDrivers.exe"" does not have anything more to do.

WinUe Sigue said...

As Roberto said (in http://portableappz.blogspot.com/2009/04/portable-flashget-173-196-multilang.html):

"When I disable the splash screen in the .ini, the program takes 3 times longer to start"
(until the cursor ceases to be busy)

WinUe Sigue said...

I was trying to remove the "cursor is busy" effect and minimize the splash screen. Tried changing values of Delay, FadeIn and FadeOut and the size of splash.bmp. The minimum values are:

advsplash::show 40 0 0 -1 $TEMP\spltmp

(with delay=20 not works)

and bitmap must be a minimum of 2X2 pixels
(with 1x1 not works).

Sorry if something bad writing, use the google translator.

Bernat said...

Cursor buzy not a problem for me: I can use even if "buzy".

Scud said...

Is is possible with this way creating portables to make portable apps like ACDSee, Flash CS4, Sound Forge 9 and other rarely portable apps?

Bernat said...

Unfortunately no.
I think only virtualization can do.

واحد موحد said...

Dear Mr . Bernat
thank you for this great tutorial but I can't understand what is the point with the big programs like Adobe progrmas
I want to aske you to simplify the tutorial in a points and make the sample program you want to teach us one of the big applications like photoshop or Illustrator .
thanks again for your time

Bernat said...

Adobe products are complicated to be portabilized with launcher and it would be too complicated so to explain.
If you read comments, many users have problems using my Adobe portable.
Simpliest is to use ThinApp.

واحد موحد said...

Ok thanks I alredy use Thinapps but I didnot work all the time some programs didnot work with the new version of thinapp old version was working good .
and I do not want to merg application with 1 giga size in one file without updae and other stuff what I want to add to my aplication .
my some advices will be great from you in this way .
thanks

Alexei said...

Hello Bernat,
The questions asked here are very usefull, thanks for your time.
My question is:
is it possible in the installation menu the option to create a folder in the Start menu (All Users) to run the application for users with Portables on their PC?
I have several times tried to do this with NSIS, but it is until now not successful.
Alexei

Bernat said...

Not tried but of course it's possible: NSIS is an installer.
I will not add this feature in my installers because it is not portable.

I use PStart to run my portable apps because I can use subfolders.

Alexei said...

Thank you for your reply Bernat.
I downloaded PStart and will see if I can use it.

Very appreciated,
Alexei

Alexei said...

Bernat said:
->I downloaded PStart and will see if I can use it.<-

Thank you for the tip, it is very user-friendly software.
Alexei

GrzegorzJZD said...

What version of Total Uninstall do You recommend? On official site there is only 5.4.0, do You have any other and are You able to share it?

Sean said...

@Bernat
Might I suggest creating a forum? It would be a better way to post your PortableAppZ as well as tutorials. You could create one section for Stable Releases of PortableAppZ, another section for Beta Releases of PortableAppZ, one for user-submitted PortableAppZ that they made using VMware ThinApp and a final section for Tutorials and FAQs.
It would be an easier and more viewer-friendly way for us to comment on your ingenious work. Would also allow users such as Josh, myself and you to provide support to those that need assistance.
If you like my idea, please take a look at FreeForums.org

Bernat said...

@Sean
Of course a forum would be better but I have no time to do more.
If you create such a forum I will link here.

Sean said...

@Bernat
I have created the forum. I am setting it up now and will let you know when it is done. You can view the forum here

Bernat said...

@GrzegorzJZD

Portable Total Uninstall 4.10 added
*.tun files are kept in MonitoredApps.

Sean said...

Mirror
Total Uninstall 4.10

archeo said...

my EMEditorPortable no edit files as external file editor in TotalCommander by F4
GoldWave is OK

Bernat said...

Did you associate EMEditorPortable to F4 in TotalCommander settings?
Your launcher EMEditorPortable must pass received parameters.

Azure said...

Code for SplashScreenName:

!include WordFunc.nsh
!include LogicLib.nsh

Var SPLASHLOGO
Function SplashLogo
CreateDirectory "$EXEDIR\Data"
ReadINIStr $0 "$EXEDIR\${APP}Portable.ini" "${APP}Portable" "DisableSplashScreen"
${If} $0 == "true"
Goto SplashLogoEnd
${AndIf} $0 == "false"
${EndIf}
WriteINIStr "$EXEDIR\${APP}Portable.ini" "${APP}Portable" "DisableSplashScreen" "false"

ReadINIStr $1 "$EXEDIR\${APP}Portable.ini" "${APP}Portable" "SplashScreenName"
StrCmp $1 "" 0 +3
WriteINIStr "$EXEDIR\${APP}Portable.ini" "${APP}Portable" "SplashScreenName" ""
Pop $1
${If} $1 == ""
StrCpy $SPLASHLOGO "$PLUGINSDIR\splash.bmp"
${Else}
StrCpy $SPLASHLOGO "$EXEDIR\Data\$1.bmp"
${EndIf}
InitPluginsDir
File /oname=$PLUGINSDIR\splash.bmp "Splash.bmp"
newadvsplash::show /NOUNLOAD 1000 300 200 0xFF00FF /L $SPLASHLOGO
WriteINIStr "$EXEDIR\Data\${APP}Portable.ini" "${APP}Portable" "LastDirectory" "$EXEDIR"
WriteINIStr "$EXEDIR\Data\${APP}Portable.ini" "${APP}Portable" "GoodExit" "false"
SetFileAttributes "$EXEDIR\Data\${APP}Portable.ini" HIDDEN
SplashLogoEnd:
FunctionEnd

kalantar said...

Can you share the sources code?

Azure said...

@kalantar: PortableAppZ_Sources

Azure said...

Hi Bernat,

I try to use SetRegView 64 with regitry.dll, but it does'nt work.
Example:
SetRegView 64
registry::MoveKey "${REGKEY1}" "${REGKEY1}-BackupBy${APP}Portable" $R0

Can you solve this problem?

Bernat said...

Did you use latest registry.dll (v4.1)?

Azure said...

Yes, I use the latest version.
${registry::MoveKey} will backup key:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{12345-67890-12345-67890} => HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{12345-67890-12345-67890} (32-bit)

on 64-bit, registry.dll will automatically add Wow6432Node after SOFTWARE
Example:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{12345-67890-12345-67890} => HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{12345-67890-12345-67890} (64-bit)

How to movekey HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{12345-67890-12345-67890} => HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{12345-67890-12345-67890} on 64-bit (without Wow6432Node)?

If I try to use SetRegView 64, it will work with DeleteRegKey, DeleteRegValue, EnumRegKey, EnumRegValue, ReadRegDWORD, ReadRegStr, WriteRegBin, WriteRegDWORD, WriteRegStr and WriteRegExpandStr, but doesn't work with registry.dll (v4.1).

Bernat said...

SetRegView 64
needs
!include "x64.nsh"

Azure said...

Not work.

Bernat said...

Tested working on Windows 7 x64.

Azure said...

Oh my bad, i've replace registry.dll with older version (v3.5) (_ _)
Thanks for reply.

===
FindProcDLL.dll is not work if EXE is for x64 :lol:
Try to run AzureusPortable on x64 machine, and run it again (make sure AllowMultipleInstances=false in AzureusPortable.ini).
Tadaa... no MessageBox like "Another Azureus is running...".

I think FindProcDLL.dll is need update.

Azure said...

Just share:

PortableAppZ Splash

Copy PortableAppZ.bmp to *Portable\Data and write SplashScreenName=PortableAppZ in *Portable.ini.

Azure said...

FindProcDLL mod by hnedka

x64 support
More infos...

Azure said...

Hi Bernat,

I have trick to ExecWait ${APPEXE} as user:
; === Begin of Source ===
Push "$EXEDIR\${APPDIR}\${APPEXE}"
Push "open"
Push '${APPSWITCH} $0'
StdUtils::ExecShellAsUser /NOUNLOAD ; need StdUtils plug-in
FindProcDLL::WaitProcEnd "${APPEXE}" -1 ; need FindProcDLL modified by hnedka
; === End of Source ===

Useful for portable app like Firefox Portable (with ThunderbirdAssociate) or Photoshop Portable, if launcher need to be run as administrator, but ${APPEXE} need to be run as user.
So... drag'n drop can be used :D

If user want launcher to execute ${APPEXE} as admin, just add ExecAsAdmin in *Portable.ini, so user can costumize.
; === Begin of Source ===
ReadINIStr $0 "$EXEDIR\${APP}Portable.ini" "${APP}Portable" "ExecAsAdmin"
StrCmp $0 "" "" +2
WriteINIStr "$EXEDIR\${APP}Portable.ini" "${APP}Portable" "ExecAsAdmin" "false"
StrCmp $0 "true" ExecAsAdmin ExecAsUser
ExecAsUser:
Push "$EXEDIR\${APPDIR}\${APPEXE}"
Push "open"
Push '${APPSWITCH} $0'
StdUtils::ExecShellAsUser /NOUNLOAD ; need StdUtils plug-in
FindProcDLL::WaitProcEnd "${APPEXE}" -1 ; need FindProcDLL modified by hnedka
Goto ExecEnd
ExecAsAdmin:
ExecWait "$EXEDIR\${APPDIR}\${APPEXE}"
ExecEnd:
; === End of Source ===

Azure said...

Hi Bernat,

What do you think with my modification of dll::UnRegLocal and dll::RegLocal?

; === Begin source ===
!define dll::UnRegLocal "!insertmacro dll::UnRegLocal"
!macro dll::UnRegLocal _CLSID
registry::_KeyExists /NOUNLOAD "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\${_CLSID}"
Pop $0
StrCmp $0 "-1" +5 ; if key doesn't exist
ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Classes\CLSID\${_CLSID}\InprocServer32" ""
IfFileExists "$0" "" +3
UnRegDLL "$0"
WriteINIStr "$EXEDIR\Data\${APP}Portable.ini" "${APP}Portable" "${_CLSID}" "$0"
!macroend

!define dll::RegLocal "!insertmacro dll::RegLocal"
!macro dll::RegLocal _CLSID
ReadINIStr $0 "$EXEDIR\Data\${APP}Portable.ini" "${APP}Portable" "${_CLSID}"
StrCmp $0 "" +3
IfFileExists "$0" "" +2
RegDLL "$0"
!macroend
; === End of source ===

Bernat said...

Interesting but there is more more than one ${_CLSID} to register a dll.
If there is a local dll not registered: the local program is not correctly installed.

Azure said...

Hi bernat,

I found other plugin like SimpleSC:
nsSCM

nsSCM.dll (5 KB) vs SimpleSC.dll (61.5 KB)

Bernat said...

Thanks.
I will have a look.

Post a Comment