Skip to content


reusable batch file boilerplate for generic use

also available as a python cookiecutter


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


├── test_cli.bat
├── test_config_prod.cmd
├── test_config_test.cmd
├── test_demos.bat
├── test_jobs.cmd
└── 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)


in jobs section add

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


    echo newjobname calling newjobtask
    call :newjobtask
    goto :eof

    echo starting newjobtask
    tasks.cmd %*


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


  • has modes for test + production

  • demo jobs

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



  • 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?