Hi,
my application use environment variable, let call it FOO.
how can i add the FOO environment variable to my project or my solution,
so the line
string foo = Environment.GetEnvironmentVariable("FOO");
will work ?
Thanks. 6 5311
The process that launches your application must set the environment variable
before it launches your application. For example, you can write a simple
batch file that sets the environment variable and then launches your
executable. It can be as simple as...
set FOO=SomeValue
MyApp.exe
"yaron" <ya***@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com... Hi,
my application use environment variable, let call it FOO.
how can i add the FOO environment variable to my project or my solution,
so the line
string foo = Environment.GetEnvironmentVariable("FOO");
will work ?
Thanks.
i forgot to tell a few details :
the problem i need to solve is to run 2 instances of my sample app
simultaneously from the folder with 2 different app configurations. so FOO is
the name of myconfig.xml file.
1. i need to be able to run my project from Visual Studio.NET 2003, so i
don't know how to this set FOO=SomeValue inside the Visual Studio IDE and not
from outside batch file. so every time the user want to change FOO value he
will change it and then press F5 (Run) from the VS.NET without the need to
leave or restart the IDE.
2. the user need to run 2 instances simultaneously of my sample application
with different values for FOO from the same sample app folder.
3. without using Main args[] parameters array ?
shortly something like VM paramerers in java.
Thanks.
"David Levine" wrote: The process that launches your application must set the environment variable before it launches your application. For example, you can write a simple batch file that sets the environment variable and then launches your executable. It can be as simple as...
set FOO=SomeValue MyApp.exe "yaron" <ya***@discussions.microsoft.com> wrote in message news:3E**********************************@microsof t.com... Hi,
my application use environment variable, let call it FOO.
how can i add the FOO environment variable to my project or my solution,
so the line
string foo = Environment.GetEnvironmentVariable("FOO");
will work ?
Thanks.
Hello yaron,
Use Environment.SetEnvironmentVariable for .NET 2.0 or P/Invoke
[DllImport("kernel32.dll", SetLastError=true)]
static extern bool SetEnvironmentVariable(string lpName, string lpValue);
y> Hi,
y> my application use environment variable, let call it FOO.
y> how can i add the FOO environment variable to my project or my
y> solution,
y> so the line
y> string foo = Environment.GetEnvironmentVariable("FOO");
y> will work ?
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
can i set environment variable in the Visual Studio.NET 2003 IDE or in the
Visual Studio project properties ? or start debuging from a batch file ?
Thanks.
"Michael Nemtsev" wrote: Hello yaron,
Use Environment.SetEnvironmentVariable for .NET 2.0 or P/Invoke [DllImport("kernel32.dll", SetLastError=true)] static extern bool SetEnvironmentVariable(string lpName, string lpValue);
y> Hi, y> my application use environment variable, let call it FOO. y> how can i add the FOO environment variable to my project or my y> solution, y> so the line y> string foo = Environment.GetEnvironmentVariable("FOO"); y> will work ?
--- WBR, Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not cease to be insipid." (c) Friedrich Nietzsche
Hello yaron,
Nope. U can't change machine settings from the VS IDE, but u can call some
app in Pre/Post build action, where your machine settings will be set.
y> can i set environment variable in the Visual Studio.NET 2003 IDE or
y> in the Visual Studio project properties ? or start debuging from a
y> batch file ?
y>
y> Thanks.
y>
y> "Michael Nemtsev" wrote:
y> Hello yaron,
Use Environment.SetEnvironmentVariable for .NET 2.0 or P/Invoke [DllImport("kernel32.dll", SetLastError=true)] static extern bool SetEnvironmentVariable(string lpName, string lpValue); y> Hi, y> my application use environment variable, let call it FOO. y> how can i add the FOO environment variable to my project or my y> solution, y> so the line y> string foo = Environment.GetEnvironmentVariable("FOO"); y> will work ? --- WBR, Michael Nemtsev :: blog: http://spaces.msn.com/laflour "At times one remains faithful to a cause only because its opponents do not cease to be insipid." (c) Friedrich Nietzsche
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Hi Michael,
if before loading VS IDE my environment variable FOO==aaa, then in the pre
or post build event i will write the command SET FOO=bbb then i will run the
program from the VS IDE (Ctrl^F5) would i see the new value for FOO which is
bbb ?
or maybe there is other trick to cause the running program from the IDE to
see the new value for FOO ?
Thanks a lot.
"Michael Nemtsev" wrote: Hello yaron,
Nope. U can't change machine settings from the VS IDE, but u can call some app in Pre/Post build action, where your machine settings will be set.
y> can i set environment variable in the Visual Studio.NET 2003 IDE or y> in the Visual Studio project properties ? or start debuging from a y> batch file ? y> y> Thanks. y> y> "Michael Nemtsev" wrote: y> Hello yaron,
Use Environment.SetEnvironmentVariable for .NET 2.0 or P/Invoke [DllImport("kernel32.dll", SetLastError=true)] static extern bool SetEnvironmentVariable(string lpName, string lpValue); y> Hi, y> my application use environment variable, let call it FOO. y> how can i add the FOO environment variable to my project or my y> solution, y> so the line y> string foo = Environment.GetEnvironmentVariable("FOO"); y> will work ? --- WBR, Michael Nemtsev :: blog: http://spaces.msn.com/laflour "At times one remains faithful to a cause only because its opponents do not cease to be insipid." (c) Friedrich Nietzsche
--- WBR, Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not cease to be insipid." (c) Friedrich Nietzsche This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Shahzad Atta |
last post by:
Hi there,
I am using a batch file to do some zipping task. This batch file get
executed on postbuild event which I set through project properties. Now
when I execute the batch file from command...
|
by: Christian |
last post by:
Another question from a not even newbie:
In Unix you can set an environment variable with the command
export PYTHONPATH
but I would like to set the variable from at .py script.
So my question...
|
by: Jimmy Cracker |
last post by:
Is it completely impossible in UNIX to push an environment variable to
the parent shell? I would like to do something like this:
main(int argc, char *argv)
{
char *var;
var = (char...
|
by: Bonj |
last post by:
Hi
My application installs a front-end GUI, which runs code when buttons are
clicked. It also installs a command-line utility, that is a console
application.
They are both installed to the...
|
by: |
last post by:
Hi all, I am trying to append a certain string to the
PATH environment variable programmatically. I am able to
read what is in the variable using the System.Environment
method...
|
by: Strauss |
last post by:
Hi:
I'm setting the INCLUDE environment variable, but VC is not searching
it for header files (I've checked it with filemon). I've tried with user
variable, machine variable, rebooted the...
|
by: Joe HM |
last post by:
Hello -
I am putting together a little ConsoleApplication that is supposed to
check for an Environment Variable and create it if it does not exist.
I found some code that will add a new...
|
by: Andy |
last post by:
Hi guys
I having a problem creating a report in Access 2003 project talking to
a SQL database through and ODBC connect.
After hours of trying things from Access Help, MSDN and Google I still...
|
by: =?Utf-8?B?QWlqdW4=?= |
last post by:
Hi!
I have just upgraded my vs 2003 project to vs 2005 project for my web
application project. However, there are fews things that I need your help to
ensure that I have done things correctly...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
| |