473,396 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

System.Diagnostics.Process.StartInfo.EnvironmentVa riables is lying to me

ceh
Hi, I'm using c# vs 2005 win xp pro sp2.

I create a cmd prompt with pInvoke via CreateProcessWithLogonW
Taskmgr shows that cmd instance running as that user.
I type set in that cmd window and it shows me the env vars.
Most importantly, it also shows a custom env var I have set.

Later, I open that proc via
StringDictionary env = myProcess.StartInfo.EnvironmentVariables;
I look at this value in the debugger and all it over shows me is the
standard system env vars.
It never shows me the ones that the process actually has.
It's as though, MS just opens the registry env vars for the user
profile and returns that when myProcess.StartInfo.EnvironmentVariables
is called.

Does anyone know if this is the case?

If so, myProcess.StartInfo.EnvironmentVariables, is lying to us.

Can anyone shed some light?

Thanks.

Aug 13 '07 #1
4 1900
Most importantly, it also shows a custom env var I have set.
This custom environment variable... when and how have you set it?

Marc
Aug 13 '07 #2
ceh
On Aug 13, 9:00 am, "Marc Gravell" <marc.grav...@gmail.comwrote:
Most importantly, it also shows a custom env var I have set.

This custom environment variable... when and how have you set it?

Marc
Via the env block passed into CreateProcessWithLogonW
Sorry, should have clarified that.

Aug 13 '07 #3
ceh
Well, thanks for pointing that out.
As unfortunate as it may be.
I think MS, in this scenario should just return an empty dictionary,
or provide some programmatic info that the env it's returning is not
the processes real env.

I know how to get that info the hard way, It looks like I'm going to
have to take that route.

Thanks.

Aug 13 '07 #4
On 13 Aug., 16:53, ceh <cehup...@gmail.comwrote:
Well, thanks for pointing that out.
As unfortunate as it may be.
I think MS, in this scenario should just return an empty dictionary,
or provide some programmatic info that the env it's returning is not
the processes real env.

I know how to get that info the hard way, It looks like I'm going to
have to take that route.

Thanks.
Hello,

I have the same problem as you. I can't get the env variables that the
process actually has.
I I have noi idea, to get the info.
Do you have actually a solution for this problem?
Could you tell me, how does you solve it?
Could you send me a code snippet ?

Thanks and best regards

Stephan

Aug 17 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Heiko Besemann | last post by:
Dear group, I created an aspx page using System.Diagnostics.Process() to launch "tracert" from shell and redirect output to Response.Output which prints it as text/plain into my browsers window....
6
by: danl | last post by:
I need to be able to execute a .bat file from a C# web application I have the following code that compliles and seems to run fine, but the bat file never does it's work...
1
by: solex | last post by:
Hello All, Hopefully someone has run into this error. I have written a class(source below) that launches a thread to monitor the StandardOutput of a System.Diagnostics.Process, in particular I...
1
by: Michael Maes | last post by:
Hi, How would I copy the file 'test.txt' from C:\_A to C:\_B. I need this through the System.Diagnostics.Process-Class and NOT the IO.File-Class p = New System.Diagnostics.Process()...
11
by: Nurit N | last post by:
This is the third newsgroup that I'm posting my problem. I'm sorry for the multiple posts but the matter becoming urgent. I hope this is the right place for it... I have created a very...
1
by: Brad | last post by:
I have an issue trying to execute commands in a web service. The command starts under the specified user. However, it never completes its execution. I can execute simple commands like "echo HELLO"...
1
by: lapucca | last post by:
Hi, I'm using VS 2005, ,.net 2 for C# windows application. I'm using Process to run a C application and redirecting its standard output so I can read it with StreamReader.ReadToEnd. It's only...
2
by: test3 | last post by:
Hello folks, I'm using System.Diagnostics.Process to start a thirdparty program (that works perfectly when started via command line). I'm using Process.StandardOutput to get the output of the...
5
by: Saya | last post by:
Hi Folks, I have now spend app. 3 days to get the below scenario to work, but can not get there! ..Net version = 2.0.50727 Windows version = Microsoft Windows = Windows Server 2003 Now I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.