Windows中当前目录和工作目录的区别 [英] Difference between Current Directory and Working Directory in Windows
问题描述
Windows 中的当前目录和工作目录有什么区别?如何更改 Notepad++ 或 Mozilla Firefox 等应用程序的工作目录?
What is the difference between Current Directory and Working Directory in Windows? How can one change working Directory for applications like Notepad++ or Mozilla Firefox?
推荐答案
当前目录和工作目录只是同一事物的两个不同名称.每个进程维护一个当前目录.
Current directory and working directory are just two different names for the same thing. Each process maintains a single current directory.
当前目录在启动时指定为用于创建进程的任何函数的参数,例如 CreateProcess
.您如何更改其中一个应用程序的当前目录?嗯,这取决于你如何开始.
The current directory is specified on startup as a parameter to whichever function is used to create the process, for example CreateProcess
. How do you change the current directory for one of your applications? Well, it depends how you start it.
- 如果您从快捷方式启动它,请更改快捷方式的属性以指定当前目录.
- 如果您从命令提示符启动,当前目录将是您启动时命令提示符的当前目录.
- 如果您首先调用
CreateProcess
,则工作电流将是您在lpCurrentDirectory
参数中传递给CreateProcess
的任何内容.如果传递NULL
,则将使用父进程的当前目录.
- If you start it from a shortcut, change the properties of the shortcut to specify the current directory.
- If you start from a command prompt, the current directory will be the current directory of the command prompt at the moment that you start it.
- If you start by calling
CreateProcess
, the working current will be whatever you pass toCreateProcess
in thelpCurrentDirectory
parameter. If you passNULL
then the current directory of the parent process will be used.
这篇关于Windows中当前目录和工作目录的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!