Portable KiCad (nightly build) in Windows


#1

I just tested portable KiCad pre-5 in Windows 10, meaning that I can copy KiCad into e.g. a usb stick and run it from there, hopefully without leaving any traces into the system. I just didn’t test it with an external drive yet, nor did I do any in-depth testing.

I just copied a whole existing KiCad installation from C:\Program Files to another folder. Then I made this batch script:

set KIPATH=%~dp0
set KICAD_CONFIG_HOME=%KIPATH%\userfiles\conf
rem Set all possible paths if you want, but KiCad guesses at least most of them correctly
%KIPATH%\bin\kicad.exe

and named it “kicad.bat”, and saved it in the new KiCad folder. I created userfiles\conf\ manually under the new KiCad folder.

KiCad can be run successfully by double clicking kicad.bat. Pcbnew and eeschema find the correct libraries.


Am I just lucky, or what
Installing multiple versions on Windows
#2

and stored it in that folder.


#3

Yeah, I remembered that only later. The original post is now edited.

Technical note if someone is interested: %~dp0 is the path (drive and path) of the batch file when it is run. The file can be located somewhere else than the KiCad base folder, but the path strings must then be changed accordingly.


#4

KiCad 5 installs as 64 bit at home. Copied that to USB as above. Running it on the other machine failed because the OS there is 32 bit. Now using KiCad EDA Portable off USB without problem.


#5

It may be possible to have a bin folder with the 64 bit binaries and another one (bin32 for example) containing the 32 bit binaries. And modify @bobc batch file to run kicad.exe from the appropriate folder, depending on the OS version.


#6

If you want to get a “more portable” installation, it is recommended to add several paths in the start / launch batch file, as @eelik already mentionned, like :

set KICAD_SYMBOL_DIR=%KIPATH%\share\kicad\library
set KICAD_TEMPLATE_DIR=%KIPATH%\share\kicad\template
set KISYS3DMOD=%KIPATH%\share\kicad\modules\packages3d
set KISYSMOD=%KIPATH%\share\kicad\modules

If not, default paths will be stored in the userfiles/conf configuration files during the first start, and KiCad will fail if the USB drive get a different drive letter on another PC.


#7

It might be better to set the environment variable responsible for the config directory instead of the ones you listed above. That way you can manage the 4 library path variables from within kicads graphical interface. (They will be saved in a file located in the config directory.)

So in short i think the patch file by @eelik is the better solution.


#8

1/ The config directory must be also set. It is not replaced by the ones I indicated.

2/ If you set the above paths with the graphical user interface, these paths will be written/saved in the config file into the form of “D:\kicad\blah_blah_etc”. If you take your USB drive and use it on another PC when it is then mounted as “F:” (for example), these saved paths will fail. Do you see what I meant ?


#9

So the whole script would be:

set KIPATH=%~dp0
set KICAD_CONFIG_HOME=%KIPATH%\userfiles\conf
set KICAD_SYMBOL_DIR=%KIPATH%\share\kicad\library
set KICAD_TEMPLATE_DIR=%KIPATH%\share\kicad\template
set KISYS3DMOD=%KIPATH%\share\kicad\modules\packages3d
set KISYSMOD=%KIPATH%\share\kicad\modules

%KIPATH%\bin\kicad.exe

#10

I even used

start %KIPATH%\bin\kicad.exe

to prevent a “terminal window” still opened while working on KiCad. Now I’m looking for a reliable way to know if it’s running on a 32 or 64 bit system to launch the appropriate bin (I have a bin32 folder and a bin64 folder inside the main directory).


#11

#12

Thanks @eelik - It works :+1:


#13

Just a quick note. There may still be problems with 100% portability where KiCad shouldn’t write anything into the system. A lock file is used for the “KiCad is already running” message. And 3d models or something about them may be cached somewhere.