8

How to open a project in PhpStorm from the command line on Windows?

I tried this: https://stackoverflow.com/questions/8304169/how-to-open-a-directory-in-phpstorm-or-intellij-or-any-jetbrains-ide-from-the][1] but can't find Tools -> Create command line launcher on Windows.

I am using the latest PhpStorm.

Karma
  • 1
  • 1
  • 3
  • 9
A K
  • 123
  • 1
  • 1
  • 11
  • 1
    Does it work if you type `"C:\Program Files\JetBrains\PhpStorm 2018.2\bin\phpstorm64.exe" "C:\PathToFolder"`? – Álvaro González Aug 26 '18 at 12:28
  • 1
    So far that launcher is implemented for Linux/Mac only. For Windows -- a bit of your time and you can do that yourself: https://stackoverflow.com/a/49455893/783119 – LazyOne Aug 26 '18 at 12:59

6 Answers6

18

To open the current directory just run:

phpstorm64 .

If you are using git bash on Windows run:

cmd "/C phpstorm64 ."

Make sure that C:\Program Files\JetBrains\PhpStorm 2018.3.3\bin is in your environment variable PATH (it is by default after the installation)

Edit 2021:

  • Install Jetbrains Toolbox
  • Go to settings
  • Enable "Shell Scripts" and follow the instructions

enter image description here

Now you can use "phpstorm ." to open the current directory.

dallin
  • 8,775
  • 2
  • 36
  • 41
super_kamil
  • 373
  • 3
  • 7
13

On macOS ( I assume on windows too) there is option to "Create Command-line Launcher". Just click that and you are good to go next time you open a terminal.

You can even specify how you would like to start "pstorm" / "phpstorm" / "ps" etc.. up to you.

enter image description here

George Mylonas
  • 704
  • 6
  • 16
7

Command-line launcher is currently only available fo UNIX; there is a feature request for providing it on Windows, IDEA-114307, please feel free to vote for it. If you like to start PhpStorm from command prompt, open cmd console, cd to %PS_install_dir%/bin and run either phpstorm64.exe or phpstorm.bat, passing a path to project folder to it, like it's described in https://www.jetbrains.com/help/phpstorm/opening-files-from-command-line.html. If you like to start it from any directory, add %PS_install_dir%/bin to your system %PATH%

lena
  • 90,154
  • 11
  • 145
  • 150
2

I know this is too late, but it will help others if they need it:

if you want to open phpStorm in the current directory via cmd/Powershell, just use this command:

phpstorm64.exe .

Or if you want to open it in another directory, just use:

phpstorm64.exe YOUR_DIRECTORY_PATH
1

as simple as that! go to your project using terminal

Cd myproject

and write phpstorm64.exe then hit enter

0

I see this is a little old but I wanted to supply my answer as I was grappling with this yesterday. My solution was to use cygwin.

Track down the phpstorm bin folder called something like C:\Users\UserName\AppData\Local\JetBrains\Toolbox\apps\PhpStorm\ch-0\201.7223.96\bin and add it to your windows system Path environment variable.

Next fire up a cygwin terminal and navigate into your project directory. I'm not a bash expert so I struggled to sort out the code as an alias but if you run:

crntproj=$(cygpath -w $PWD)

phpstorm.bat $crntproj

You need cygpath because simply running phpstorm.bat $PWD doesn't work as PHPStorm tries to open a folder called $PWD. I tried a bunch of variations trying to get it to open and none seemed to work.

It will fire up phpstorm with the current folder as the project path. And you now have a terminal feed from your project too.

Ben Graham
  • 11
  • 3