You are here

Portable preferences on Windows (USB sticks etc.)


First a little testimony: I have it up and running on Vista Home Premium 64 bit without problems (ok it crashed once).

Then a little tutorial. In Coccinella .96.0 I cannot select the 'always store user preferences on same drive as program' option. So here is a little install script to take your login details etc. with you everywhere you go.

!!note: this is a very crude script and it will overwrite the existing settings on a pc if Coccinella has been running there before. You've been warned!!

1- Create a new folder in the Coccinella directory, call it "CoccinellaPrefs".

2- Find your user settings file in this folder: %UserProfile%\AppData\Roaming\Coccinella
In most cases your UserProfile dir will look like C:\Documents and Settings\UserName
The file is called WBPREFS.TXT

3- Copy WBPREFS.TXT to the new "CoccinellaPrefs" folder

4- make a new textfile in the "CoccinellaPrefs" folder, paste the following code :
'------------- START ----------------------
Option Explicit
On Error Resume Next

'Declare var's and objects
Dim WshS, fso, RegKey, RegVal, Result, apd, apf
Set WshS = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

'Get application data folder
RegKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\"
RegVal = WshS.RegRead (RegKey & "AppData")
apd = WshS.ExpandEnvironmentStrings(RegVal) & "\"

apf = apd & "Coccinella\"
If Not fso.FolderExists(apf) Then
Set newfolder = fso.CreateFolder(apf)
End If

fso.CopyFile "WBPREFS.TXT", apf, TRUE
'------------- END ----------------------

5- Save the file as "InstallPrefs.vbs" (make sure that it doesn't get the .txt extension)

6- Run this file to import your preferences on the local computer.



Do you want to write a real tutorial to put in the documentation section of the website? And if so, can you also update your tutorial to the behaviour of the upcoming Coccinella version?

Mvg, Sander Devrieze.

Well it's a bit of a hack really, because it possibly overwrites the settings of the current user.
Atm the "portable" function of Coccinella doesn't seem to work, but I suppose it will in a future version, so I don't know if this should get official support..?

I don't know about the behaviour of the upcoming Coccinella, but it won't be a problem to update once a working/test build is released :)


If Mats implemented my idea without bugs, it will work like this:

  • During startup Coccinella will look in the current directory if there is a config file available.
  • If yes: it will use this file.
  • If not: it will use the system path for the config file.
  • This will allow you to put the binary versions of Coccinella for all platforms in the same directory on your USB stick together with the config file. This stick then can be used on all supported platforms with the same config file. (So, it's better than Portable Firefox which only supports Windows ;-) )

Mvg, Sander Devrieze.