Instead of installing PureBasic_Windows setup file, copy and create a shortcut to get the portable version.
A small batch to extract PureBasic_Windows_xxxx.exe to .\PureBasic_Windows_xxxx directory.
It creates the PureLibraries\UserLibraries folder, renames the help file and creates PureBasic_Portable shortcut.
You need to have innounp.exe, the Inno Setup Unpacker, next to the batch
Code: Select all
@Echo Off
Title Extract Purebasic Portable...
SetLocal
If [%1] Equ [] (
Echo.
Echo Pass the Purebasic setup file as parameter or with drag'n drop
Echo Ex:
Echo %~n0%~x0 "PureBasic_Windows_xxxxx.exe"
Echo.
pause
Exit
)
Set ShortcutName=PureBasic_Portable
:: Help file: Comment, Uncomment following your choice
Set HelpLanguage=English
::Set HelpLanguage=French
::Set HelpLanguage=German
Set File=%1
Set Filename=%~n1%~x1
Set FilenameWext=%~n1
Echo.
Echo Extract %Filename% setup file
Echo To %FilenameWext% directory...
Echo.
innounp.exe -x -b -a -d"%~dp0PureBasic_Files" "%File%"
md "%~dp0PureBasic_Files\{App}\PureLibraries\UserLibraries"
If "%HelpLanguage%"=="English" (ren "%~dp0PureBasic_Files\{App}\PureBasic,1.chm" "PureBasic.chm")
If "%HelpLanguage%"=="French" (ren "%~dp0PureBasic_Files\{App}\PureBasic,2.chm" "PureBasic.chm")
If "%HelpLanguage%"=="German" (ren "%~dp0PureBasic_Files\{App}\PureBasic,3.chm" "PureBasic.chm")
move "%~dp0PureBasic_Files\{App}" "%~dp0%FilenameWext%" 1>nul 2>nul
rd /S /Q "%~dp0PureBasic_Files"
Echo Set WshShell = WScript.CreateObject("WScript.Shell") > "%~dp0CreateShortcut.vbs"
Echo Set oLink = WshShell.CreateShortcut("%~dp0%FilenameWext%\%ShortcutName%.lnk") >> "%~dp0CreateShortcut.vbs"
Echo oLink.TargetPath = "%~dp0%FilenameWext%\PureBasic.exe" >> "%~dp0CreateShortcut.vbs"
Echo oLink.WorkingDirectory = "%~dp0%FilenameWext%" >> "%~dp0CreateShortcut.vbs"
Echo oLink.Description = "PureBasic Portable Development Environment" >> "%~dp0CreateShortcut.vbs"
Echo oLink.Arguments = "/PORTABLE" >> "%~dp0CreateShortcut.vbs"
Echo oLink.Save >> "%~dp0CreateShortcut.vbs"
cscript "%~dp0CreateShortcut.vbs"
del /Q "%~dp0CreateShortcut.vbs"
If Exist "%~dp0%FilenameWext%\%ShortcutName%.lnk" (
Echo "%Filename%" Successfully extracted & Echo to "%FilenameWext%" directory) else (
Echo Extraction of "%Filename%" Failed!)
Echo.
Ping -n 4 127.0.0.1 > nul