什么是windows中(linux)bin目录的等价物?

虽然所有操作系统都有一些共同点,但您可能会发现自己在想,一种操作系统是否有另一种操作系统所具有的特定“功能”。有鉴于此,今天的超级用户问答帖子回答了一位好奇的读者的问题。...

什么是windows中(linux)bin目录的等价物?

虽然所有操作系统都有一些共同点,但您可能会发现自己在想,一种操作系统是否有另一种操作系统所具有的特定“功能”。有鉴于此,今天的超级用户问答帖子回答了一位好奇的读者的问题。

今天的问答环节是由SuperUser提供的,SuperUser是Stack Exchange的一个分支,是一个由社区驱动的问答网站分组。

图片由BiblioArchives/LibraryArchives(Flickr)提供。

问题

超级用户读者Toby Blunt想知道Windows中是否有(Linux)bin目录的等效目录:

Is there an equivalent for Linux’s bin directory in Windows? If so, how can I access it from the command prompt?

什么是Windows中(Linux)bin目录的等价物?

答案

超级用户黑客帮我们找到了答案:

There is actually nothing special about /bin on Unix/Linux at all. It is just the location where executable files and scripts (which are not actually binary files) are placed by convention. It is included in the PATH environment variable by default for all users.

As Ryan says (comments one and two), the \Windows\System32 directory on Windows is also in PATH for all Windows users (and, even if it is not, the program loader in Windows will search there anyhow).

You can easily create your own equivalent of /bin on Windows. To make it system-wide, place it somewhere like the root of the file system (such as C:\bin or under an already-restricted location like \Windows\System32\bin), and add it to the PATH environment variable for all users.

For a per-user location, create the directory in your own profile (%USERPROFILE%\bin) and add it to your account’s PATH environment variable. Windows combines environment variables with the same name, so anything in the machine PATH variable is also added to any user’s PATH, but not the other way around.

Of course, you will have to add files, scripts, shortcuts, and symlinks to your /bin directory yourself. Windows installers do not expect such a thing and will not put files there automatically the way that Linux installers usually do.

请务必通过下面的链接阅读此问题线索的其他有趣答案!


有什么要补充的解释吗?在评论中发出声音。想从其他精通技术的Stack Exchange用户那里了解更多答案吗?在这里查看完整的讨论主题。

  • 发表于 2021-04-10 04:59
  • 阅读 ( 104 )
  • 分类:互联网

你可能感兴趣的文章

mono是什么?它如何帮助windows切换到linux?

...p的特殊IDE(集成开发环境),有点类似于visualstudio的Linux等价物。 ...

  • 发布于 2021-03-12 18:14
  • 阅读 ( 615 )

什么是shell脚本,为什么要使用它

... 既然您已经知道了shell脚本是什么以及它们的许多优点,您不想在任务中使用它们吗?您在使用它们时遇到了哪些问题?请在下面的评论中告诉我们。 ...

  • 发布于 2021-03-13 04:53
  • 阅读 ( 248 )

这就是软件安装程序在windows、macos和linux上的工作方式

...的命令。但是当你运行安装程序或者发出命令时,会发生什么呢? ...

  • 发布于 2021-03-14 18:20
  • 阅读 ( 266 )

如何在linux中使用ls命令

...供与每个条目相关联的数值。很明显,你不知道这个值是什么意思。因此,要以可读的方式列出文件及其大小,请在命令中使用-lh标志。 ...

  • 发布于 2021-03-26 18:01
  • 阅读 ( 188 )

使用这些linux命令高效地管理远程ssh连接

...候学习如何只使用别名通过SSH高效登录、传输单个文件或目录、执行远程SSH命令以及轻松地将远程服务器装载到本地目录了。 ...

  • 发布于 2021-03-28 06:44
  • 阅读 ( 228 )

关于linux中bash for loops的所有知识

... Bash认识到这种情况,并将do视为in$@do中for的等价物,其中,$@是表示命令行参数的特殊变量。 ...

  • 发布于 2021-03-29 06:22
  • 阅读 ( 312 )

如何使用受限shell来限制linux用户可以做什么

受限的shell限制了用户帐户在Linux上可以做什么。受限用户不能更改其目录,您可以控制他们可以访问哪些命令。下面介绍如何在Linux上设置受限shell。 受限炮弹 受限shell不是另一个shell。这是标准外壳的另一种模式。Bash、Kor...

  • 发布于 2021-03-31 10:57
  • 阅读 ( 387 )

如何在linux上查找和删除断开的符号链接

...在,而不是目标文件。如果符号链接创建不正确,它可能什么都没有指向,但真正的目标是存在的。在这种情况下,重新创建符号链接将是解决方法。 也有可能是一个明显损坏的符号链接被用作其他东西,例如文件锁的指示器...

  • 发布于 2021-04-01 09:09
  • 阅读 ( 210 )

如何在linux中向$path添加目录

...操纵器之一。它会悄悄地影响你的用户体验,但这并没有什么不好的地方。我们将解释它的作用,以及如何调整它。 什么是$path,它是如何工作的($path on linux, and how does it work)? 当您在终端窗口中键入一个命令并按Enter键时,...

  • 发布于 2021-04-02 14:04
  • 阅读 ( 188 )

如何在linux上使用suid、sgid和sticky位

...icky位是强大的特殊权限,您可以为Linux上的可执行文件和目录设置这些权限。我们将分享使用它们的好处和潜在的缺陷。 它们已经在使用了 将安全性构建到多用户操作系统中会出现几个难题。以密码(看似)的基本概念为例...

  • 发布于 2021-04-02 14:48
  • 阅读 ( 174 )
Ci30818915777
Ci30818915777

0 篇文章

相关推荐