ti posso fare un esempio in VBS su come scrivere variabili d'ambiente:

Set WshShell = Wscript.CreateObject("WScript.Shell")
Set WshEnv = WshShell.Environment ("Volatile")
WshEnv("Prova")="test"


ho poco tempo adesso, ma ti consiglio di dare un'occhiata alla funzione Environ....