How to check your path in Command Prompt - laravel

I'm learning Laravel and found this direction on their documentation:
"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
Question:
How exactly I make sure the folder is on my PATH? What's the command?
If I'm not on the PATH, how to get there? I tried to find /.composer/vendor/bin but got nothing.
I'm using Windows 8 64bit.

1) windows: PATH | grep -oP ".composer.*bin"
If it's in the path You'll get a response if it's not you'll get nothing.
2)
~/ refers to home path on linux doing %HOMEPATH% on windows results in the same thing, which in your case would be %HOMEPATH%/.composer/vendor/bin
Doing /somefolder Will go to the root path in linux and try to find a folder there called somefolder but won't do anything in windows, I'm not sure what the equivalent in windows is, might be referring to root of the drive, I.e. C:\ or D:\ etc.
To add .composer/vendor/bin to your home path you need to go to your environmental variables and add it into the path you can go here and follow the steps in the answer or the question.
The important bit:
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%.
Make note though that this only sets it for the current user context, to set it for all users you have to to use setx /M.

for those who also needs the answer for this question, I found it here.
Basically, all you need is to write:
cd %APPDATA%\Composer\vendor\bin

Related

commands work in home directory, but not anywhere else

I'm trying to set up a dev environment on my Mac Mini running Bir Sur 11.2.3. I can add commands to the .zshrc file, but they only seem to work in my home directory. For example...
chris#chriss-mac-mini an_app % which flutter dart
flutter not found
dart not found
chris#chriss-mac-mini an_app % cd ~
chris#chriss-mac-mini ~ % which flutter dart
dev/flutter/bin/flutter
dev/flutter/bin/dart
My .zshrc file looks like this...
chris#chriss-mac-mini ~ % cat .zshrc
export PATH="$PATH:dev/flutter/bin"
Why am I unable to use the flutter command in other directories on this machine?
Short answer: change the line in your .zshrc to this:
export PATH="$PATH:$HOME/dev/flutter/bin"
Long answer: the path you added to your PATH environment variable, dev/flutter/bin, doesn't start with "/" so it's a relative path, meaning it'll be resolved relative to wherever your current working directory happens to be. If you're in /Users/cjmcqueen (or whatever your home directory is), it'll resolve to /Users/cjmcqueen/dev/flutter/bin, which is presumably where the actual binaries are. But if you're in /random/other/path, it'll resolve to /random/other/path/dev/flutter/bin, which probably doesn't even exist (let alone contain binaries for the flutter, dart, etc commands).
To solve this, you need to add a full absolute path to the binaries, instead of a relative one. In some situations, ~ will expand to the path to your home directory (so ~/dev/flutter/bin will work), but not in all situations. In this particular situation, $HOME is better because the shell will expand it to the absolute path to your home directory before storing it in the PATH variable, so you don't have to depend on something else resolving it later.
export PATH="$PATH:dev/flutter/bin" is referencing a relative path.
dev/flutter/bin should be something like /Users/<user>/dev/flutter/bin.
In the terminal, go to the directory for your flutter bin folder and type pwd. This is the full path it should reference.

iverilog environment set up on macbook

I tried to make iverilog command s.t I can run verilog program on my Macbook Air.
After few steps for installing the files, the tutorial told me to type:
export PATH=~/bin:/usr/local/iverilog/bin
It worked in terms of iverilog command, i.e, I can compile .v file. However, normal command like ls, man,etc.
I guess it is the problem of the PATH of the command sets, which means those normal unix command is not located.
Can someone tell me how to fix it and I dont need to export the PATH everytime?
You didn't add your paths to the current paths established by the OS. Instead, you replaced it with your paths. This is what you need to do in order to add paths to your PATH variable:
export PATH=$PATH:~/bin:/usr/local/iverilog/bin
The $PATH part is your current PATH value, which is added (concatenated actually) to the list of new paths you want to add. This is turn is assigned to PATH variable.
To make this additions permanent, you may want to add the above line to the end of your .profile file, or .bash_profile (whatever you have in OS X)
You can also do as this:
http://architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion/
Which says that you can edit the file /etc/paths and add whatever paths you want to add, one per line, then save that file and your added paths are available. In this case, just remember to use absolute paths. That is, paths starting with / . The first one you use: ~/bin is not an aboslute path. You need to convert it to an absolute path. To do this, remember that ~ is a shortcut to your HOME directory: something like /Users/myloginname. Type echo $HOME to find it out.

Windows environment variable issue

I have two environment variables defined as:
test1=C:\something\dir1
test2=C:\something\dir2
And I'm trying to run the following command:
copy dir1\filename.txt dir2\filename.txt
I know that if I write the copy command with the environment variables it will work, like below:
copy %test1%\filename.txt %test2%\filename.txt
But isn't there a better way to do this? If Windows doesn't find the "dir1" directory in its current directory, won't it try to find it with the system variables it has?
EDIT: Im trying to use the copy command without typing the enviroment variable's name in the command.
Something like "copy dir1\filename.txt dir2\filename.txt", where, if Windows cant find the dir1 directory in its current directory, it would automatically search this directory with the enviroment variables. Is this possible?
This will copy the fully qualified path and filename, and cater for spaces etc.
copy "%test1%\filename.txt" "%test2%\"
If it doesn't work for you then edit your question and give more details about the task.

exectuable path pointing to the wrong location, how do I update

I recently updated a nodejs executable using npm and now the executable is pointing to the wrong location. when I run the which command in terminal it is pointing to the old non-existant location. How do I update the executable path or shortcut. I'm not a unix person so not sure where that is set.
I don't necessarily need to update the path for all my apps in the environment, just curious to know why that path for the old executable is still hanging around and pointing to the wrong location.
bash caches the paths to executables you've run. You can reset the cache with "hash -r" (or start a new bash session or terminal).
I don't think which ever returns something that doesn't exist. It shows you which version of the executable is being found, based on the search order in your $PATH environment variable.
This $PATH variable is set in your shell. Type $PATH in the terminal to see what your path variable is set to. (Probably something like /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin)
See this question for some instructions to change your shell path variable: Set environment variables on Mac OS X Lion
Can you give more specific examples of where this stuff is, and what files you are looking at, because I don't think your description makes sense (with regard to "pointing to the old non-existant location")?

Setting environmental variable in batch as a path (not working for me) on Windows

I want to set my folder C:\Users\scruff\Desktop\MinGW2\Cross as variable PREFIX
So I type:
set PREFIX=C:\Users\scruff\Desktop\MinGW2\Cross
But then when I do:
cd PREFIX
I get
"The system cannot find the specified path".
When I do
echo %PREFIX%
I get:
C:\Users\scruff\Desktop\MinGW2\Cross
when is do:
cd C:\Users\scruff\Desktop\MinGW2\Cross
it takes me to the cross directory fine.
:(
Try cd %prefix%.
DOS/Windows batch files aren't really very clever, you might want to investigate Powershell as an alternative: http://technet.microsoft.com/en-us/scriptcenter/dd742419

Resources