cmd needs to be a list of text, as whatever you see on shell separated by blanks. E.g.
"ls -l /var/www" should be cmd=['ls','-l','/var/www']
That said, cd is better done with os.chdir. Set is better done with providing the environ dictionary into subprocess calls. Multiline is better done by putting several lines into a shell script (which can take parameters) so you do not have to mess up in python.
here is an example. If a command is not in OS's $PATH, you can fully qualify its path
from subprocess import Popen
cmd=['cd',r'C:Program Files (x86)Notepad++','&&','notepad','LICENSE','&&',r'D:ProgramToolsPutty.exe','-v']
d=Popen(cmd, shell=True)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…