473,725 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can i put 2 configuration files for my Console application ?

Hi all,

I want to give a sample console application for the user with 2
configuration files.
I want to give also a 2 .bat files for running the sample application, one
for each configuration file.
How can i choose in the .bat file which configuration file to use ?
(something like myApp.exe -D file1.config).

Thanks.

Dec 27 '05 #1
6 1448
if you are asking about command parameter value then use %1 as variable.

I could not get teh correct link but this link do have some examples that
will give you some idea.

http://www.microsoft.com/technet/arc...ain/batch.mspx
"yaron" <ya***@discussi ons.microsoft.c om> wrote in message
news:33******** *************** ***********@mic rosoft.com...
Hi all,

I want to give a sample console application for the user with 2
configuration files.
I want to give also a 2 .bat files for running the sample application, one
for each configuration file.
How can i choose in the .bat file which configuration file to use ?
(something like myApp.exe -D file1.config).

Thanks.

Dec 27 '05 #2
i don't know how to run myApp.exe once with file1.config and once with
file2.config as the configuration file (without copying file1.config or
file2.config to myApp.exe.confi g).
"Pohihihi" wrote:
if you are asking about command parameter value then use %1 as variable.

I could not get teh correct link but this link do have some examples that
will give you some idea.

http://www.microsoft.com/technet/arc...ain/batch.mspx
"yaron" <ya***@discussi ons.microsoft.c om> wrote in message
news:33******** *************** ***********@mic rosoft.com...
Hi all,

I want to give a sample console application for the user with 2
configuration files.
I want to give also a 2 .bat files for running the sample application, one
for each configuration file.
How can i choose in the .bat file which configuration file to use ?
(something like myApp.exe -D file1.config).

Thanks.


Dec 27 '05 #3
no you can't do that. but what you can do is that you can change the name of
config file to run with another config file.
"yaron" <ya***@discussi ons.microsoft.c om> wrote in message
news:32******** *************** ***********@mic rosoft.com...
i don't know how to run myApp.exe once with file1.config and once with
file2.config as the configuration file (without copying file1.config or
file2.config to myApp.exe.confi g).
"Pohihihi" wrote:
if you are asking about command parameter value then use %1 as variable.

I could not get teh correct link but this link do have some examples that
will give you some idea.

http://www.microsoft.com/technet/arc...ain/batch.mspx
"yaron" <ya***@discussi ons.microsoft.c om> wrote in message
news:33******** *************** ***********@mic rosoft.com...
> Hi all,
>
> I want to give a sample console application for the user with 2
> configuration files.
> I want to give also a 2 .bat files for running the sample application,
> one
> for each configuration file.
> How can i choose in the .bat file which configuration file to use ?
> (something like myApp.exe -D file1.config).
>
> Thanks.
>


Dec 27 '05 #4
don't understand you, please give an example for your solution.

Thanks.
"Pohihihi" wrote:
no you can't do that. but what you can do is that you can change the name of
config file to run with another config file.
"yaron" <ya***@discussi ons.microsoft.c om> wrote in message
news:32******** *************** ***********@mic rosoft.com...
i don't know how to run myApp.exe once with file1.config and once with
file2.config as the configuration file (without copying file1.config or
file2.config to myApp.exe.confi g).
"Pohihihi" wrote:
if you are asking about command parameter value then use %1 as variable.

I could not get teh correct link but this link do have some examples that
will give you some idea.

http://www.microsoft.com/technet/arc...ain/batch.mspx
"yaron" <ya***@discussi ons.microsoft.c om> wrote in message
news:33******** *************** ***********@mic rosoft.com...
> Hi all,
>
> I want to give a sample console application for the user with 2
> configuration files.
> I want to give also a 2 .bat files for running the sample application,
> one
> for each configuration file.
> How can i choose in the .bat file which configuration file to use ?
> (something like myApp.exe -D file1.config).
>
> Thanks.
>


Dec 27 '05 #5
When you compile your application you get a config file with the name of exe
file and config as extension (assuming you have added app.config in your
project). now you can have 2 files wiht different settings e.g.

1- application.exe .config
2- application.exe .config.notinus e

now when you have to use config file #2 then you can change the name of #1
to something like application.exe .config.notinus enow and you can change the
#2 as application.exe .config

now when you will run your application #2 config file will be used.
other way could be that you read second config file (which is nothing more
than xml file) and using xml features in language you can read the tags and
values. little involved process but might work for the settings you are
needing.

just wondering, what is the diff between two files youhave?
"yaron" <ya***@discussi ons.microsoft.c om> wrote in message
news:82******** *************** ***********@mic rosoft.com...
don't understand you, please give an example for your solution.

Thanks.
"Pohihihi" wrote:
no you can't do that. but what you can do is that you can change the name
of
config file to run with another config file.
"yaron" <ya***@discussi ons.microsoft.c om> wrote in message
news:32******** *************** ***********@mic rosoft.com...
>i don't know how to run myApp.exe once with file1.config and once with
> file2.config as the configuration file (without copying file1.config or
> file2.config to myApp.exe.confi g).
>
>
> "Pohihihi" wrote:
>
>> if you are asking about command parameter value then use %1 as
>> variable.
>>
>> I could not get teh correct link but this link do have some examples
>> that
>> will give you some idea.
>>
>> http://www.microsoft.com/technet/arc...ain/batch.mspx
>>
>>
>> "yaron" <ya***@discussi ons.microsoft.c om> wrote in message
>> news:33******** *************** ***********@mic rosoft.com...
>> > Hi all,
>> >
>> > I want to give a sample console application for the user with 2
>> > configuration files.
>> > I want to give also a 2 .bat files for running the sample
>> > application,
>> > one
>> > for each configuration file.
>> > How can i choose in the .bat file which configuration file to use ?
>> > (something like myApp.exe -D file1.config).
>> >
>> > Thanks.
>> >
>>
>>
>>


Dec 27 '05 #6
ok, got you, i hope that there was other option like myApp.exe -D file1.config.

Thanks a lot.
"Pohihihi" wrote:
When you compile your application you get a config file with the name of exe
file and config as extension (assuming you have added app.config in your
project). now you can have 2 files wiht different settings e.g.

1- application.exe .config
2- application.exe .config.notinus e

now when you have to use config file #2 then you can change the name of #1
to something like application.exe .config.notinus enow and you can change the
#2 as application.exe .config

now when you will run your application #2 config file will be used.
other way could be that you read second config file (which is nothing more
than xml file) and using xml features in language you can read the tags and
values. little involved process but might work for the settings you are
needing.

just wondering, what is the diff between two files youhave?
"yaron" <ya***@discussi ons.microsoft.c om> wrote in message
news:82******** *************** ***********@mic rosoft.com...
don't understand you, please give an example for your solution.

Thanks.
"Pohihihi" wrote:
no you can't do that. but what you can do is that you can change the name
of
config file to run with another config file.
"yaron" <ya***@discussi ons.microsoft.c om> wrote in message
news:32******** *************** ***********@mic rosoft.com...
>i don't know how to run myApp.exe once with file1.config and once with
> file2.config as the configuration file (without copying file1.config or
> file2.config to myApp.exe.confi g).
>
>
> "Pohihihi" wrote:
>
>> if you are asking about command parameter value then use %1 as
>> variable.
>>
>> I could not get teh correct link but this link do have some examples
>> that
>> will give you some idea.
>>
>> http://www.microsoft.com/technet/arc...ain/batch.mspx
>>
>>
>> "yaron" <ya***@discussi ons.microsoft.c om> wrote in message
>> news:33******** *************** ***********@mic rosoft.com...
>> > Hi all,
>> >
>> > I want to give a sample console application for the user with 2
>> > configuration files.
>> > I want to give also a 2 .bat files for running the sample
>> > application,
>> > one
>> > for each configuration file.
>> > How can i choose in the .bat file which configuration file to use ?
>> > (something like myApp.exe -D file1.config).
>> >
>> > Thanks.
>> >
>>
>>
>>


Dec 27 '05 #7

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

Similar topics

2
8681
by: Alexander Kienzle | last post by:
I'm new to Java programming. I'm developing a Servlet for tomcat which needs an external configuration file. With external I mean a file (in XML format) which is customizable and not contained in my package. I don't want to hardcode any path and I would like to be independent of the application server (tomcat, websphere,...). Until now, I put the file in my package and open it using obj.getClass.getResourceAsStream but when I put my...
3
2881
by: Florida Coder | last post by:
I have the need to store some application specific configuration data to be used by a class library and or a windows service. I would like to do this in a fashion similar to the way we do with applications and web services without having to use the machine.config file. I know that I could use the code below to do this but the problem then becomes that when using a shared assembly both the assembly and the config file need to be put...
7
5987
by: MrNobody | last post by:
I was a Java developer so I'm used to using property files as a means to keep configuration settings for my apps. I'm wondering what options are there with ..NET? Some settings I want to include are like a root directory for a target program on the user's machine my app uses, which they would be prompted to supply at startup. Normally the registry is used for this but I'd rather not use the registry if possible. Isn't there some kind of...
5
1610
by: Arsalan Ahmad | last post by:
Hi all, I am developing a simple one page application in ASP.NET which takes an input in a text box and print in a label. But when i uploaded it to the website i get the following error: Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
3
1471
by: Cacho | last post by:
Hi All I'm totally new to vbasic net and need to get values from a config files in the way: <configuration> <appSettings> <add key="Desvio" value="652825616" /> <add key="MargenString" value="10" /> </appSettings>
7
22488
by: Mike Livenspargar | last post by:
We have an application converted from v1.1 Framework to v2.0. The executable references a class library which in turn has a web reference. The web reference 'URL Behavior' is set to dynamic. We added an entry to the executable's .exe.config file to specify the URL, and under the 1.1 framework this worked well. Unfortunately, this is not working under the 2.0 framework. I see in the Reference.cs file under the web service reference the...
0
1128
by: leung.cheung | last post by:
Any suggestions for the follwing senario: I have created a console application that take State name as input. Each state has its own settings, and that settings are set by local administrator of each state. How do I use multiple .config files for a signle application? When the application loads, I want to point it to use a configuration file that in the subfolder for each state, and use the settings from the .config file.
7
10828
by: =?Utf-8?B?RG91Z2llIEJyb3du?= | last post by:
Hi I've written custom configuration section (inherits from System.Configuration.ConfigurationSection) to simplify the contents of the config file and to make life easier when accessing them in code. The configuration section is contained within the exe (it's a simple test case!) and everything works well debugging within the IDE or if the application is deployed on a drive or share that has been granted full trust. For the share the...
5
2082
by: Author | last post by:
This may sound like a silly question. I rarely do console or windows form applications. In a console application, I have an XML configuration file. I place it under my application root. In my code, I also say string configFilePath = "./configuration.xml"; When I debug the application with VS 2005, I get an error which says
0
9401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9113
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8097
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.