OS: Windows 7.
Why when I try to run some command that are avaliable through command line I got "Can not run command. ..... The system can not find the file specified"
Is it possible to run external commands via this tool on windows?
What kind of commands? Please provide an example.
If this command is internal for (only available in) cmd.exe (like "start", "dir" etc, then NO -- you cannot run them (unless Command Line Tool has its own implementation/emulates it). External commands (like "xcopy", "ping" etc) can run just fine since they are implemented as separate executable files.
But you can execute cmd.exe in Command Line Tool and then you will be able to use those "start", "dir" etc internal commands, since you will be running them via cmd.exe (do not forget to use "exit" when done -- cmd.exe is still a program).
I mean commands like external framework utilities for example "npm install".
I know that I can run "cmd" And there execute what I want. Running via cmd has some drawbacks, for example there is no auto scrolling to the end of the output of executing console program and command history doesn't work as well.
And actually I've run into other more strage issues when running tools via "cmd" in Command Line Tool. (for example node programs can not use process.stdin raw mode, jitsu (nodejisu hosting deploy tool) is not working correctly either.
What is way to add internal tools that can be run via Command Line Tool?
If IDE cannot find such command automatically from PATH environment variable .. then you can create an alias which should work (at least it works OK for me)
1) Settings | Command Line Tool Support
2) Create new entry of "Custom" type
3) Fill all required fields
4) Execute new command
For example, "npm ll -g" will show me correct output
Thanks will try this approach. But should IDE lookup in the PATH env var?
Yes, it should.
I do not know why it cannot find npm in this case -- maybe dev can answer you this.
IDE looks into PATH. But there is known Windows issue that IDE can't get changes in PATH without restart. Is it your issue?
Not in my case:
command: pear -- PhpStorm cannot find it (but in is in the PATH)
command: pear.bat -- works fine
command: npm -- PhpStorm cannot find it (but in is in the PATH)
command: npm.bat -- cannot find as well
RE: npm -- maybe, just maybe, it's because I do have 64 bit installation of node.js .. and since IDE is 32-bit .. it may have issues finding it (not sure at all, just an idea)
Is there a way that allows to dump PATH variable from within IDE (command line tool in paricular) ?
Well its being a looong time for me since I used any windows, but AFAIR
you all are forgetting about %PATHEXT% variable - windows cmd appends all included extensions to your "command" - that's why "pear" can be used to run "pear.bat" in cmd.
I'm not sure wether we want/should use or emulate that behavior within IDE - feel free to submit a request - but current one is quite an expected and logial.
I'm fine with pear vs pear.bat. I mean -- I do understand why it happens (IDE searches for exact file name, without utilizing PATHEXT or just simple .exe/.bat options). Having IDE to look for alternate names (at least on Windows: EXE/BAT) would definitely be beneficial.
But PhpStorm is still unable to find npm.bat
My PATH as seen from cmd.exe (when PhpStorm is running)
My PATH variables from "My Computer | System Properties | Advanced | Environment variables" (Windows 7 x64 SP1 Ultimate ENG)
User variable section:
System variables section (after replacing ";" by "\n" in text editor):
C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\
C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\
C:\Program Files\Microsoft SQL Server\100\Tools\Binn\
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\
C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\
C:\Program Files (x86)\EaseUS\Todo Backup\bin\x64\
C:\Program Files (x86)\Java\jre7\bin
Apparently on my work computer I have nodejs installed in custom location (E:\Projects\nodejs\) while at home I do have it at default C:Program Files\nodejs (64 bit installation). In any case -- IDE cannot find it in both cases.
But in any case: I personally do create custom tool for any of such commands -- does the job for me. I just have not tried it beyond basic yet (talking about npm here).. so not sure if it will install/update packages properly (but it can see *globally* installed packages fine so far).
Actually, screw that .. I made a mistake
I'm used to the fact that every tool installed via PEAR will be *.bat on Windows. With nodejs .. it's actually .bat for one file and .cmd for the actual npm -- and npm.cmd works fine (IDE can find and execute that).
I guess filling a ticket about checking for at least .exe/.bat/.cmd on Windows is good idea (as it should do the job in majority of cases).
It seems it may be a bug. I'm too on Win 7 x64.