Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

batch file which makes a zip package under Windows after you build C::B

(1/1)

ollydbg:
When you build the C::B, for me, it is the CodeBlocks_wx32_64.workspace, you make need to run the update32_64.bat, which generate all the files in a folder named: output32_64.

Now, I would like to make a portable C::B package, which need all the dll files from the mingw/gcc compiler and the wx dlls.

So, here is the script I do to copy those files:


--- Code: ---set PATH=D:\code\msys2\mingw64\bin;D:\code\wxWidgets-3.2.2.1\lib\gcc_dll;%PATH%

copypedeps.exe -r codeblocks.exe Package/

--- End code ---

Please not that the tool "copypedeps.exe" is from Releases brechtsanders/pedeps, which copy all the needed dll to a folder named "Package".

Now, here comes another batch file, which make a zip


--- Code: ---@echo off

REM Step 1: Remove all files with .a extension
del /S *.a

REM Step 2: Copy all files and folders to the "package" subfolder
mkdir package
xcopy /S /I /E /Y *.* package\

REM Step 3: Go to the "package" folder
cd package

REM Step 4: Zip all files and folders to a zip file with the current date
for /f "tokens=2 delims==" %%G in ('wmic os get localdatetime /value') do set "datetime=%%G"
set "datestamp=%datetime:~0,8%"
set "timestamp=%datetime:~8,6%"
set "zipfile=cb-%datestamp:~0,4%-%datestamp:~4,2%-%datestamp:~6,2%-%timestamp%.zip"


REM Compress all files and folders (excluding "release" folder) to a zip file using the "zip" command
zip -r "%zipfile%" . -x "release/*"


REM Optional: Verify the zip file was created successfully
if exist "%zipfile%" (
    echo Zip file created: %zipfile%
) else (
    echo Failed to create zip file.
)


REM Step 5: Move the zip file to the "release" folder
move "%zipfile%" "release\"

REM Optional: Verify the file was moved successfully
if exist "release\%zipfile%" (
    echo File moved to the release folder.
) else (
    echo Failed to move the file.
)


REM Step 6: Optional - Display a message when the process is complete
echo Batch file execution completed successfully.
pause

--- End code ---

In the above code, I just make a zip file named: cb-2023-10-14-094447.zip, and move this file to the "release" folder.

So, you can simply distribute this zip file.

I hope this page will help you if you would like to make a C::B package which contains all the dll and exe files. You can simply start the portable C::B by running CbLauncher.exe.

Note1: if you run codeblocks.exe, the config file is created in your C:/users/yourname/..., while if you run CbLauncher.exe, the config file is stored in you local directory.

Note2: the zip command I use if named infozip 3.0, which is mentioned in this wiki page: 2.4.1 ZIP

Navigation

[0] Message Index

Go to full version