rem 1. Create a variable to hold the count:
rem 2. Show this variable in the prompt:
prompt `[%ncmd] $P$g`
rem 3. Increment the count after each command:
alias post_exec=`set ncmd=%@inc[%ncmd]`
Note the use of backquotes to prevent variables and functions from being expanded prematurely.
Many, many years ago, back when I was using 4DOS, it was either Charles or Rex who provided me with a method to "imitate" the bash shell prompt, giving a prompt that shows the command count. I am still using it.