mardi 31 mars 2015

Changing userpath with python

i wanted to change the environment variable using python, but i need to load into the Windows Command Shell a variable which is stored in python.


I tried it like this :



userpath = 'C:/test_folder'
cmd = 'Path=%Path%; %s' % (userpath)
os.system(cmd)


But im am getting this error here : Traceback (most recent call last): File "J:\Python_Script\path_cahnge.py", line 7, in cmd = 'Path=%Path%; %s' % (userpath) ValueError: unsupported format character 'P' (0x50) at index 6


can someone help me with that ?


Thanks


Aucun commentaire:

Enregistrer un commentaire