I’m writing a script which needs to get mainboard serial number (on Windows) by
wmic baseboard get serialnumber
in cmd which means I have to use the following command in python:
sr = subprocess.check_output('wmic baseboard get serialnumber')
but, since the current directory of a target PC cmd may be different to the directory containing the wmic.exe to execute, first of all I have to change the cmd directory to
C:\Windows\SysWOW64\wbem
which is executed by the following command in cmd:
cd C:\Windows\SysWOW64\wbem
But, how can I run late cmd command through python script?