如何在所有目录中使用特定命令?

How to use a specific command in all directories?

注意:很抱歉,如果我将此张贴在错误的堆栈交换网站上。我在这个网站上看到过类似的问题。如有不妥请指正

所以我将 VLC 安装到目录 D:\misc\vlc 中,当我在命令提示符中键入“vlc”时,它会启动 VLC 媒体播放器。但是,我想在目录 D:\slam\ 中 运行 这个“vlc”命令。但是,每次我这样做时,它都会说“'vlc' 不被识别为内部或外部命令, 可运行的程序或批处理文件。".

有没有办法在任何目录中 运行 'vlc' 命令?

感谢任何帮助。

您可以使用“编辑环境变量”对话框将 vlc 程序添加到 Windows 中的 PATH。假设 Windows 10(虽然这个对话框也存在于旧版本中),这里是如何将程序添加到路径:

  1. Open the Start Search, type in “env”, and choose “Edit the system environment variables”
  2. Click the “Environment Variables…” button.
  3. Under the “System Variables” section (the lower half), find the row with “Path” in the first column, and click edit.
  4. The “Edit environment variable” UI will appear. Here, you can click “New” and type in the new path you want to add. From this screen you can also edit or reorder them.
  5. Dismiss all of the dialogs by choosing “OK”.
  6. Your changes are saved! You will probably need to restart apps for them to pick up the change. Restarting the machine would ensure all apps are run with the PATH change.

在上面的步骤 4 中,您将键入的新路径是包含 vlc 程序的目录,例如“D:\杂项”。请注意,添加此目录还将使“misc”目录中的任何其他程序也可以访问。