Run CMD Command In Python Script - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Run CMD Command In Python Script (/thread-33639.html) |
Run CMD Command In Python Script - shantanu97 - May-12-2021 I have a couple of batch command and also wanted to execute sql query commands like sqlcmd using Python script. sqlcmd -S catalyst.database.windows.net -d Catalyst -U Automation -P F537!q -Q "Exec esusp_MRA_Report_SL4_HDR" bcp MDR.MDReportHeader out "D:\Client Data\Catalyst\MRT\SL4_HDR.txt" -S catalystmetals.database.windows.net -d CatalystQuest -U Automation -P F537!qAv+u_Ky -q -c -t \t sqlcmd -S catalyst.database.windows.net -d Catalyst -U Automation -P F537!q -Q "Exec esusp_MRA_Report_SL4" bcp mdr.MDReport out "D:\Client Data\Catalyst\MRT\SL4_DATA.txt" -S catalystmetals.database.windows.net -d CatalystQuest -U Automation -P F537!qAv+u_Ky -q -c -t \t Copy "D:\Client Data\Catalyst\MRT\SL4_HDR.txt" + "D:\Client Data\Catalyst\MRT\SL4_DATA.txt" "D:\Client Data\Catalyst\MRT\SL4.txt" Del "D:\Client Data\Catalyst\MRT\SL4_HDR.txt" Del "D:\Client Data\Catalyst\MRT\SL4_DATA.txt"Can anyone tell me how to run all the commands from python script? RE: Run CMD Command In Python Script - Axel_Erfurt - May-12-2021 subprocess RE: Run CMD Command In Python Script - Gribouillis - May-13-2021 Subprocess' page at Python module of the week |