控制台应用程序试图做一个ChDir? [英] Console App trying to do a ChDir?

查看:57
本文介绍了控制台应用程序试图做一个ChDir?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




有关我使用VS 2005 beta 2的信息


我有一个控制台应用程序,我希望它能够相当于一个更改

目录(CD)命令,你将在正常的命令行模式下执行

如下:

Hi,

For info I am using VS 2005 beta 2

I have a Console App and I want it to do the equivalent of a Change
Directory (CD) command that you would do in normal command line mode as
follows:

CD ToASubDir
CD ToASubDir




我使用System.IO.Directory命名空间来查询我的位置,并查看

的可用子目录等。这样工作正常但我在该命名空间中找不到任何物理更改目录的
。我已经尝试了

Directory.SetCurrentDirectory(path)运行但只更改了应用程序

逻辑当前目录,而不是它的物理当前目录。我甚至试过了

Environment.CurrentDirectory = path;无济于事。


任何人都可以指出正确的功能,可以做一个ChDir(CD)


TIA

克里斯



I am using the System.IO.Directory namespace to query where I am and look
for available subdirectories etc. This works fine but I cannot find anything
in that namespace that will physically change the directory. I have tried
Directory.SetCurrentDirectory(path) which runs but only changes the apps
logical current directory, not its physical current directory. I even tried
Environment.CurrentDirectory = path; to no avail.

Can anybody point me at the correct function that will do a ChDir (CD)

TIA
Chris

推荐答案




你想做什么?


最接近cd XXX的是Environment.CurrentDirectory

欢呼,


-

Ignacio Machin,

ignacio.machin AT dot.state.fl.us

佛罗里达州交通局


" Chris" <章*** @ discussions.microsoft.com>在消息中写道

新闻:EE ********************************** @ microsof t.com ...
Hi,

what is what you want to do?

The closest to cd XXX is Environment.CurrentDirectory
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:EE**********************************@microsof t.com...


有关我正在使用VS 2005 beta 2的信息

我有一个控制台应用程序,我想要它执行相当于在正常命令行模式下执行的更改
目录(CD)命令,如下所示:
Hi,

For info I am using VS 2005 beta 2

I have a Console App and I want it to do the equivalent of a Change
Directory (CD) command that you would do in normal command line mode as
follows:
CD ToASubDir
CD ToASubDir



我正在使用System.IO.Directory命名空间来查询我的位置,并查看
可用的子目录等。这样可以正常但我找不到
任何东西
在该命名空间中将物理更改目录。我已经尝试过运行但只更改应用程序
逻辑当前目录的Directory.SetCurrentDirectory(path),而不是它的物理当前目录。我甚至尝试了
Environment.CurrentDirectory = path;无济于事。

任何人都可以指出正确的功能,将会做一个ChDir(CD)

TIA
Chris



I am using the System.IO.Directory namespace to query where I am and look
for available subdirectories etc. This works fine but I cannot find
anything
in that namespace that will physically change the directory. I have tried
Directory.SetCurrentDirectory(path) which runs but only changes the apps
logical current directory, not its physical current directory. I even
tried
Environment.CurrentDirectory = path; to no avail.

Can anybody point me at the correct function that will do a ChDir (CD)

TIA
Chris



Ignacio,


恐怕我已经这样做了,它没有改变

命令的目录窗口。

在VB中似乎有一个ChDir命令,我认为这就是我想要的b $ b,只在c#中,但似乎没有相应的。


我希望最终的结果是命令窗口执行ChDir(CD)

就像我在命令中手动完成它一样窗口。

Environment.CurrentDirectory没有实现,就像我原来的帖子一样。


我目前正在寻找从kernel32调用的东西,但我找不到

功能是什么。曾经有一个方便的小实用程序列出所有

api调用和他们使用的参数VB 3/4/5/6 ???一个

或以上所有。这还有吗?


无论如何谢谢

Chris
Ignacio,

I am afraid I did that already and it did not change the directory for the
command window.
In VB there appears to be a ChDir command, that I think is what I want to
do, only in c# but there does not appear to be an equivalent.

I want the end result to be that the command window executes a ChDir (CD)
just as if I had done it by hand in the command window.
Environment.CurrentDirectory does not achieve that, as per my original post.

I am currently looking at calling something from kernel32 but I cant find
what the function is. There used to be a handy little utility that listed all
the api calls and the parameters they used that came with VB 3/4/5/6 ??? one
or all of the above. Is that still available somewhere?

Thanks anyway
Chris


Chris< Ch ** *@discussions.microsoft.com>写道:
Chris <Ch***@discussions.microsoft.com> wrote:
我恐怕已经这样做了,它没有改变
命令窗口的目录。
I am afraid I did that already and it did not change the directory for the
command window.




我不要相信你能做到这一点。听起来好像不想改变这个过程的当前目录,但对于* parent *进程,

这是完全不同的东西。 (它也非常不友好,

IMO。如果我在命令窗口中更改了一个特定目录,那么这是因为我想要在那里。)


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet

如果回复小组,请不要给我发邮件



I don''t believe you can do that. It sounds like don''t want to change
the current directory for the process, but for the *parent* process,
which is something entirely different. (It''s also pretty unfriendly,
IMO. If I''ve changed to one particular directory in a command window,
it''s because I want to be there.)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


这篇关于控制台应用程序试图做一个ChDir?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆