https://github.com/rbaltrusch/objectbatch
An object-oriented extension of the Windows batchfile language
https://github.com/rbaltrusch/objectbatch
batch batch-file batchfile object-batch object-oriented-programming oop-library
Last synced: 11 months ago
JSON representation
An object-oriented extension of the Windows batchfile language
- Host: GitHub
- URL: https://github.com/rbaltrusch/objectbatch
- Owner: rbaltrusch
- License: mit
- Created: 2021-02-13T19:21:19.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-08T11:43:10.000Z (over 2 years ago)
- Last Synced: 2025-01-11T21:13:34.320Z (about 1 year ago)
- Topics: batch, batch-file, batchfile, object-batch, object-oriented-programming, oop-library
- Language: Batchfile
- Homepage:
- Size: 53.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](https://github.com/rbaltrusch/objectbatch/actions/workflows/run_tests.yml)

[](https://opensource.org/licenses/MIT)
# Object oriented batch
Objectbatch is an object-oriented extension of the Windows batchfile language, including classes and instances, methods and attributes, inheritance, encapsulation, polymorphism and object composition.
Simple use of a class instance:
```batch
::instantiate new object obj of type MyClass
call new MyClass obj construct
::calling method myMethod of instance obj
call # obj myMethod
::reading obj attribute myAttr
echo !%obj%.myAttr!
::writing obj attribute myAttr
set %obj%.myAttr=1
```
Simple class definition:
```batch
::boilerplate
call class %*
%class%
::this is the constructor, adding one custom attribute attr
:public-construct
call super %*
set %self%.attr=0
exit /b
```
## Getting started
To get a copy of this repository, simply open up git bash in an empty folder and use the command:
$ git clone https://github.com/rbaltrusch/objectbatch
To use objectbatch anywhere, add the objectbatch folder to your Windows PATH.
## More information
For more information on the various object-oriented features available, please have a look at the [examples](https://github.com/rbaltrusch/objectbatch/tree/master/examples) and the [wiki](https://github.com/rbaltrusch/objectbatch/wiki).
An example object-oriented batchfile repository can be found [here](https://github.com/rbaltrusch/batch_transactions).
## Limitations
- Changed object state within a local scope (`setlocal`) can only persist by using `save.bat`.
- Batchfile bug: it seems that instantiating many objects at once causes older objects to vanish. Circumvent this issue by serialising with `save.bat`.
## Contributions
Any contributions, such as additional features, bugfixes, or documentation are much appreciated. Contribution guidelines are specified in [CONTRIBUTING.md](https://github.com/rbaltrusch/objectbatch/blob/master/CONTRIBUTING.md).
## License
This repository is open-source software available under the [MIT license](https://github.com/rbaltrusch/objectbatch/blob/master/LICENSE).
## Contact
Please raise an issue for code changes. To reach out, please send an email to richard@baltrusch.net.