Connection Info in Custom File

Hi
How Can use basic variable like basePath ,Connection info ,… in custum file?
i need " Connection Info " in Custom File to Run Mysqldump and make backup , how can i get it ?

This might help: How to Load Data from Database into Custom Files (v2025).