View Single Post
Old 07-10-2008   #4 (permalink)
sylan


 
 

RE: Read config file

That's what I needed. Thanks!

"Leo Tohill" wrote:
Quote:

> The standard for .net applications is an xml file named after the exe, with a
> .config suffix. For example, the config for hello.exe would be
> hello.exe.config. The outer elements and some inner elements are
> standardized, but the format can also be extended in a specified manner.
> The System.Configuration.ConfigurationManager namespace of the framework
> contains classes that support reading and writing such config files, and you
> can of course call those methods from Powershell.
>
> While you don't have an exe and thus won't get some of the automagic that
> comes from the exe.config association, you could still follow that format and
> use methods of the ConfigurationManager class to access a file with a name
> like "myscript.ps1.config".
>
> Even if you don't want to use the standard format for the content, I think
> using xml and that .config naming convention would be a good idea.
>
> - leo
>
>
> "sylan" wrote:
>
Quote:

> > I'm working on a script that will read in configuration information and
> > perform actions based on that.
> >
> > Is there a "best practice" for doing this? Essentially, I'd like to read in
> > things like database name, input file locations, output file locations, etc.
> > Should I use INI, XML, something else?
My System SpecsSystem Spec