While reading my last post on reading environment variables from a guest operating system, you may wonder how to set environment variables. Don’t be disappointed if I tell you that there is NO direct support for setting an environment variable.
However, you have a workaround – use a command directly. Unlike reading variables, there is no standard ways to do it for different operating systems. You have to first figure out what type of operating system and then run different commands. For example, if you are targeting Windows family of operating systems, you simply run the following: