如何在命令提示符中检查您的路径

How to check your path in Command Prompt

我正在学习 Laravel 并在他们的文档中找到了这个方向:

"Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable is found when you run the laravel command in your terminal." http://laravel.com/docs/4.2/installation#install-laravel

问题:

  1. 我如何确定该文件夹在我的 PATH 中?命令是什么?

  2. 如果我不在 PATH 上,如何到达那里?我试图找到 /.composer/vendor/bin 但一无所获。

我正在使用 Windows 8 64 位。

1) windows: PATH | grep -oP ".composer.*bin"

如果它在路径中你会得到一个响应,如果它不在你什么也得不到。

2) ~/ 指的是 linux 上的主路径,在 windows 上执行 %HOMEPATH% 结果相同,在您的情况下是 %HOMEPATH%/.composer/vendor/bin

执行 /somefolder 将转到 linux 中的根路径并尝试在那里找到一个名为 somefolder 的文件夹,但不会在 windows 中执行任何操作,我我不确定 windows 中的等价物是什么,可能指的是驱动器的根目录,即C:\D:\

要将 .composer/vendor/bin 添加到您的主路径,您需要转到您的环境变量并将其添加到您可以转到 here 的路径中,然后按照答案或​​问题中的步骤操作。

重要的一点:

Example of windows SETX command:

Print the PATH environment variable:

C:\Users\Charity>echo %PATH% C:\windows\system32;C:\windows and space;C:\foobar Use setx to set the environment variable:

C:\Users\Charity>setx PATH "%PATH%;C:\zombiepoke" SUCCESS: Specified value was saved. Close and re-open cmd terminal, then run:

C:\Users\Charity>echo %PATH% C:\windows\system32;C:\windows and space;C:\foobar;C:\zombiepoke You have to be careful with double quotes. If you let quotes get into your path variable it might break something. However they are necessary for specifying addendums to the original %PATH%.

请注意,这仅为当前用户上下文设置它,要为所有用户设置它,您必须使用 setx /M

对于那些也需要这个问题答案的人,我在这里找到了。

基本上,你只需要写:

cd %APPDATA%\Composer\vendor\bin