WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

UAC

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Elevation Level and Environment Varibles

 Keywords: Manifest Elevation Level UAC  Environment Varibles Win7 EnvItemize

Question:

Yesterday, I attempted to use the EnvItemize function to import the list of environment strings. To my dismay, the new string that I defined, via the SET command, was absent from the list.

My procedure was as follows.

  1. Open a command prompt window.
  2. Run the SET command.
  3. Start WinBatch Studio from the command prompt.
  4. Load the script containing the EnvItemize function.
  5. Run the script in debug mode, with a breakpoint.
  6. Examine the string returned by EnvItemize.
I have a couple of theories about why this is so. Before I spend too much more time investigating, I decided to ask for input.

Please advise.

Answer:

The following MSFT blog post partially explains what is going on http://blogs.msdn.com/b/cjacks/archive/2008/10/29/why-don-t-elevated-applications-receive-environment-variables-set-by-non-elevated-calling-process.aspx What is relevant is how the application is manifested and whether or not UAC is enabled. What may be a bit counter intuitive and is not mentioned by Mr. Russinovich is that even when the launching application is already elevated, the launched admin privilege manifested application will not be a true child process of the launching application.
Article ID:   W18312
Filename:   Elevation Level and Environment Varibles.txt
File Created: 2012:05:14:10:46:58
Last Updated: 2012:05:14:10:46:58