Sometimes it will be required to invoke batch files from within the Python script file. We can easily achieve this by following these simple steps.
1. Import the module "OS" import os
2. Use the command os.system("batch_file") . Replace the word batch_file with the required file name. In fact it will work with all the dos commands. Please note that the command is in quotes. This is required as the particular command accepts input of data type string.
For a batch file to get invoked, it must be in the current working folder of the Python script. Else the working folder must be changed. DOS searches first in the current directory for the requested batch file. If not found, it will look for the file in any of the locations listed in the "PATH" system environment variable.