Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Bat‑KV – A tiny single‑file KV database for Windows Batch scripts (github.com/water-run)
1 point by WaterRun 3 months ago | hide | past | favorite
Windows Batch (BAT) is well-known for its limited capabilities and retro syntax — to the point where even basic persistent storage lacks simple, generic tools. Bat-KV, as the name suggests, is a tiny “BAT library” that provides the simplest possible persistence layer: basic CRUD operations stored in a custom plain-text .bkv file.

It’s ultra‑lightweight (the whole project is just 346 lines — trivial for an LLM), and extremely easy to use. Just download it from the GitHub Release page (https://github.com/Water-Run/Bat-KV/releases/tag/Bat-KV), drop it into your script directory, and "import" it.

Here’s a minimal example:

batch @echo off REM Minimal Bat-KV usage example

REM Create database call Bat-KV.bat :BKV.New echo Create database: %BKV_STATUS%

REM Add data call Bat-KV.bat :BKV.Append "name" "Alice" call Bat-KV.bat :BKV.Append "age" "25" call Bat-KV.bat :BKV.Append "city" "Beijing"

REM Read data call Bat-KV.bat :BKV.Fetch "name" echo Name: %BKV_RESULT%

call Bat-KV.bat :BKV.Fetch "age" echo Age: %BKV_RESULT%

REM Check if data exists call Bat-KV.bat :BKV.Include "email" if "%BKV_RESULT%"=="No" ( echo Email not set, adding default... call Bat-KV.bat :BKV.Append "email" "[email protected]" )

REM Delete data call Bat-KV.bat :BKV.Remove "city" echo Remove city: %BKV_STATUS%

pause

The repository also includes a test program and a simple DBMS, along with detailed documentation to help you get started quickly. If this tiny project is useful to you, consider leaving a star to support it :)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: