import os, subprocess import tee long_string = "0123456789" * 30 # just to have it over 255 chars (the OS limit is 8192 !) # this works, the only difference is that the called program is not included in quotes :p cmd_a = r'C:\Windows\System32\help.exe "%s"' % (long_string) # no in real life you may need to quote the program been executed because the path (may) contain spaces cmd_b = r'"C:\Windows\System32\help.exe" "%s"' % (long_string) # if we add additional quotes it will run just fine cmd_c = r'""C:\Windows\System32\help.exe" "%s""' % (long_string) cmd = cmd_b print("-"*80) os.system(cmd) print("-"*80) subprocess.Popen(cmd, shell=True)