Skip to content

Getting Started

Rose1440 edited this page Aug 12, 2024 · 3 revisions

This is how to get started making apps for batchOS.

Your First App

To make your first batchOS app, go to the "app" folder and make a folder named "helloworld". Then, make a main.bat file in your folder, and put the following code into it:

@echo off

title My First batchOS App
echo Hello World! 
echo.
echo This is my first batchOS app!
set a=50
set b=50
set /a c=a+b
echo.
echo %a% + %b% is %c%!
timeout /t 5 /nobreak >nul
call api\exit_app.bat

To run this in batchOS, just boot the OS and type "helloworld" into the terminal! (Due to a technical limitation in batchOS v0.1, this does not run. Fix coming in v.0.2)

Now, let's go over the following code, shall we?

@echo off just hides the commands from the output.

title My First batchOS App changes the name of Command Prompt at the top of the window.

echo Hello World! types in "Hello World" into the console.

echo. shows an empty line.

set a=50 sets the value of the enviroment variable "A" to 50.

set /a c=a+b sets the value of the variable "C" to be the output of "A" + "B".

echo %a% + %b% is %c%! displays the values of the variables "A", "B", and "C".

timeout /t 5 /nobreak >nul waits for 5 seconds without executing the next command without being able to be interrupted or displaying the command in the console.

call api\exit_app.bat runs the Batch file "exit.app", which exits the app and returns to the shell. However, this is not recommended for apps that run in the shell, because it will clear the screen.

So, that's the entirety of the code done. Now, you can use this to start making simple apps on batchOS!

Clone this wiki locally