Skip to content

readme

reusable batch file boilerplate for generic use

also available as a python cookiecutter

usage

cli.bat :initfolder 20180606

see demos.bat for more

instructions and layout

main features

  • test and production modes
  • modular
  • extendable (one app per project can run multiple jobs)
  • configurable
  • maintainable
  • logging is included

one of the variable names makes no sense, it is %box%

that was due to the original implementation, change it to something readable


layout

.
├── test_cli.bat
├── test_config_prod.cmd
├── test_config_test.cmd
├── test_demos.bat
├── test_jobs.cmd
├── test_readme.md
└── test_tasks.cmd
  • cli.bat runs with parameters (jobname) (optional - yyyymmdd)
  • cli.bat creates timestamp log in /logs
  • cli.bat gets settings from config_[test|prod].bat
  • cli.bat calls jobs.cmd
  • jobs.cmd calls (one or more) tasks.cmd

  • cli.bat - (command line interface) - configure additional parameters (default are (:jobname) (optional - yyyymmdd))

    • :main
      • this calls (:jobname)
    • :jobname
      • see examples
  • config_(test|prod).cmd
    • setup test or production folders and variables
  • jobs.cmd
    • when you call a :jobname this gets imported
    • jobs handle logic and can call multiple tasks
  • tasks.cmd
    • define multiple tasks here and call them from jobs.cmd

adding a job (template)

cli.bat

in jobs section add

:newjobname
    echo calling function %0
    jobs.cmd %*
    goto :eof

jobs.cmd

:newjobname
    echo newjobname calling newjobtask
    call :newjobtask
    goto :eof


:newjobtask
    echo starting newjobtask
    tasks.cmd %*

tasks.cmd

:newjobtask
    echo newjobtask [%*]
    rem do stuff
    goto :eof

2018-06-06

  • has modes for test + production

  • demo jobs

    • :initfolder
    • :addsentfile
    • :removetestdata
    • :removelogsjob

kanban

todo

  • add test/prod logging
  • add holiday check
  • add self doc
  • add backup
  • prompt option r to run anyway if sent exists rename sent (stamp) to run again?

references