471,354 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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 1352
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***@discussions.microsoft.com> wrote in message
news:33**********************************@microsof t.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.config).
"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***@discussions.microsoft.com> wrote in message
news:33**********************************@microsof t.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***@discussions.microsoft.com> wrote in message
news:32**********************************@microsof t.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.config).
"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***@discussions.microsoft.com> wrote in message
news:33**********************************@microsof t.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***@discussions.microsoft.com> wrote in message
news:32**********************************@microsof t.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.config).
"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***@discussions.microsoft.com> wrote in message
news:33**********************************@microsof t.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.notinuse

now when you have to use config file #2 then you can change the name of #1
to something like application.exe.config.notinusenow 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***@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.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***@discussions.microsoft.com> wrote in message
news:32**********************************@microsof t.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.config).
>
>
> "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***@discussions.microsoft.com> wrote in message
>> news:33**********************************@microsof t.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.notinuse

now when you have to use config file #2 then you can change the name of #1
to something like application.exe.config.notinusenow 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***@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.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***@discussions.microsoft.com> wrote in message
news:32**********************************@microsof t.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.config).
>
>
> "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***@discussions.microsoft.com> wrote in message
>> news:33**********************************@microsof t.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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Alexander Kienzle | last post: by
5 posts views Thread by Arsalan Ahmad | last post: by
3 posts views Thread by Cacho | last post: by
7 posts views Thread by Mike Livenspargar | last post: by
7 posts views Thread by =?Utf-8?B?RG91Z2llIEJyb3du?= | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.