Jump to content

Read Environment Variable Values of Different Apps


Recommended Posts

I am looking to create a script that will read the environment variables maintained by different processes and the values they hold.

To illustrate what I am looking for I created a small example script.....

$MyPet=EnvGet("Pet")

MsgBox(0,"My Pet",$MyPet)

Compile this to a simple Exe call pet.exe and save to the root for Drive C:

Now start two seperate CMD sessions.

In the first window type "set pet=fido"

Then run pet.exe

You will get a small popup window that shows that PET resolved to "Fido".

In the second Window run pet.exe.

In this case "Pet" has no value so "Fido" will not be shown.

My goal is to query every running process for the variable "Pet" and retrieve the value.

Mind you I want to query process beyond those I have created so I can't modify those applications.

Rather I want an AutoIt script to attempt to retrieve read the variables from those apps.

I have no clue if this is possible.

That is why I'm asking the brilliant minds here.

Link to comment
Share on other sites

Each command shell is its own environment. You will have to have something running in each of those environments to pass you the variables. An AutoIt script in one environment can pass data to another script, but one script can't read the evironment variables directly from a different environment.

:rolleyes:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Each command shell is its own environment. You will have to have something running in each of those environments to pass you the variables. An AutoIt script in one environment can pass data to another script, but one script can't read the evironment variables directly from a different environment.

:rolleyes:

Thanks.

I was wanting to read from across environments if possible.

Sounds like it may not.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...