dir执行的是什么 [英] What dir executing is done from
问题描述
我想读一个与我的.exe文件位于同一目录的ini文件。
但是我怎么能这样做而不需要为我的所有
程序安装。
让我试着详细说明:
PC 1让我的C#程序位于C:\ Application \ Csharp.exe
这里我需要在C中读取我的ini文件:\ Application \ csharpini.ini
PC 2我的C#程序在于X:\Programs\Csharpprogram\Csharp.exe
在这里,我需要阅读我的ini文件
X:\Programs \Csharpprogram \Csharpini。 ini
提前Thx ...
Mads W.
Hey Mads,
尝试使用System.Windows.Forms.Application.StartupPath
获取启动应用程序的可执行文件的路径,不是
包括可执行文件名。
-Moty-
" Mad s W. < MW @ [删除] datasign.dk>在留言中写道
新闻:%2 **************** @ tk2msftngp13.phx.gbl ...我想要读取与我的.exe
文件位于同一目录的ini文件。
但是如何在不必为所有程序安装完成相同的目录的情况下执行此操作。
让我试着详细说明:
PC 1让我的C#程序位于C:\ Application \ _Csharp.exe
这里我需要读取我在C中的ini文件:\ Application \\\ techarpini.ini
PC 2我的C#程序位于X:\Programs\Csharpprogram\Csharp.exe
这里我需要读取我的ini文件在
X:\Programs\Csharpprogram\Csharpini.ini
Thx提前......
Mads W。>
hi
Assembly.Location:
Assembly.GetExecutingAssembly()。位置
欢呼,
-
Ignacio Machin,
ignacio.machin at dot.state.fl.us
佛罗里达州交通局
" Mads W." < MW @ [删除] datasign.dk>在留言中写道
新闻:%2 **************** @ tk2msftngp13.phx.gbl ...我想要读取与我的.exe
文件位于同一目录的ini文件。
但是如何在不必为所有程序安装完成相同的目录的情况下执行此操作。
让我试着详细说明:
PC 1让我的C#程序位于C:\ Application \ _Csharp.exe
这里我需要读取我在C中的ini文件:\ Application \\\ techarpini.ini
PC 2我的C#程序位于X:\Programs\Csharpprogram\Csharp.exe
这里我需要读取我的ini文件在
X:\Programs\Csharpprogram\Csharpini.ini
Thx提前......
Mads W。>
再次谢谢你的回答。
我无法让大会工作。
作为我的应用程序是一个控制台应用程序,我没有尝试Windows.Forms的事情。
这适用于我:
Environment.CurrentDirectory
MSDN声明使用System.Collection myst。
Greets ...
Mads
Ignacio Machin(.NET / C#MVP)" < ignacio.machin AT dot.state.fl.us> skrev
i en meddelelse news:u%**************** @ TK2MSFTNGP12.phx.gbl ...hi <组装。位置:
Assembly.GetExecutingAssembly()。位置
欢呼,
-
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
佛罗里达州交通局
Mads W. < MW @ [删除] datasign.dk>在消息中写道
新闻:%2 **************** @ tk2msftngp13.phx.gbl ...我想读一个ini文件位于与我的.exe
文件相同的目录中。
但是我怎么能这样做而不必为我的所有程序安装都有相同的目录。
让我试着详细说明:
PC 1让我的C#程序位于C:\ Application \ _Csharp.exe
这里我需要在C:\ Application中读取我的ini文件\ csharpini.ini
PC 2我的C#程序位于X:\Programs\Csharpprogram\Csharp.exe
这里我需要阅读我的ini文件> X:\Programs\Csharpprogram\Csharpini.ini
Thx提前......
Mads W。
I want to read an ini file which is located in the same dir as my .exe file.
But how can I do that without having to have the excact same dir for all my
program installations.
Let me try to elaborate:
PC 1 has my C# program lying in C:\Application\Csharp.exe
Here I need to read my ini file in C:\Application\csharpini.ini
PC 2 hs my C# program lying in X:\Programs\Csharpprogram\Csharp.exe
Here I need to read my ini file in
X:\Programs\Csharpprogram\Csharpini.ini
Thx in advance...
Mads W.
Hey Mads,
Try using System.Windows.Forms.Application.StartupPath
Gets the path for the executable file that started the application, not
including the executable name.
-Moty-
"Mads W." <mw@[REMOVE]datasign.dk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...I want to read an ini file which is located in the same dir as my .exe
file.
But how can I do that without having to have the excact same dir for all
my program installations.
Let me try to elaborate:
PC 1 has my C# program lying in C:\Application\Csharp.exe
Here I need to read my ini file in C:\Application\csharpini.ini
PC 2 hs my C# program lying in X:\Programs\Csharpprogram\Csharp.exe
Here I need to read my ini file in
X:\Programs\Csharpprogram\Csharpini.ini
Thx in advance...
Mads W.
hi
Assembly.Location:
Assembly.GetExecutingAssembly().Location
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Mads W." <mw@[REMOVE]datasign.dk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...I want to read an ini file which is located in the same dir as my .exe
file.
But how can I do that without having to have the excact same dir for all
my program installations.
Let me try to elaborate:
PC 1 has my C# program lying in C:\Application\Csharp.exe
Here I need to read my ini file in C:\Application\csharpini.ini
PC 2 hs my C# program lying in X:\Programs\Csharpprogram\Csharp.exe
Here I need to read my ini file in
X:\Programs\Csharpprogram\Csharpini.ini
Thx in advance...
Mads W.
Hi again, thx for your answers.
I couldn''t get the Assembly to work.
As my app is a consoleapplication, I didn''t try the Windows.Forms thing.
This worked for me:
Environment.CurrentDirectory
The MSDN states that System.Collection myst be used.
Greets...
Mads
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> skrev
i en meddelelse news:u%****************@TK2MSFTNGP12.phx.gbl...hi
Assembly.Location:
Assembly.GetExecutingAssembly().Location
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Mads W." <mw@[REMOVE]datasign.dk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...I want to read an ini file which is located in the same dir as my .exe
file.
But how can I do that without having to have the excact same dir for all
my program installations.
Let me try to elaborate:
PC 1 has my C# program lying in C:\Application\Csharp.exe
Here I need to read my ini file in C:\Application\csharpini.ini
PC 2 hs my C# program lying in X:\Programs\Csharpprogram\Csharp.exe
Here I need to read my ini file in
X:\Programs\Csharpprogram\Csharpini.ini
Thx in advance...
Mads W.
这篇关于dir执行的是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!