Solved

INI location question

Posted on 2004-04-28
5
201 Views
Last Modified: 2010-04-15
I need to edit the ini file in notepad from the windows directory (or application directory)... how do I do that without hardcoding it?

System.Diagnostics.Process.Start("notepad.exe", "c:\\windows\\myini.ini");
0
Comment
Question by:sticar
5 Comments
 
LVL 22

Expert Comment

by:_TAD_
ID: 10939457


Use the

Application.StartUpPath

or something like that.


The Application object has a lot of usefull things
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 10939500
Check under Environment. There is a property that gives you the system folder.
0
 
LVL 48

Accepted Solution

by:
Jay_Jay70 earned 125 total points
ID: 10984554
Try the following

System.Diagnostics.Process.Start( "notepad.exe", Environment.GetEnvironmentVariable("windir").ToString() + "\\myini.ini" );


JJ
0
 

Author Comment

by:sticar
ID: 11000599
Sorry... I went on vacation before trying this out.  I'll let you know tomorrow....Thanks for the input.
0
 

Author Comment

by:sticar
ID: 11014679
Perfect!  Thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question