for i, a in enumerate(sys.argv[1:]):
    if '=' not in a:
        break
name, _, value = a.partition('=')
os.environ[name] = value
sys.exit(subprocess.call(sys.argv[i:]))
Temporary PYTHONPATH in Windows