Kim Viberti
Kim Viberti

Reputation: 33

How to launch Android Studio from terminal on Windows (and Linux)?

I'm struggling to understand how to open applications from shell. When I use Atom, I can just run

$ atom .

command to open it in the current directory, but I don't know how to do it with Android Studio.

I don't know if it has something to do with aliases, environment variables or something else, but I'd like to know how this stuff works. I'd also appreciate a short comparison of the same problem on Linux.

Upvotes: 2

Views: 17126

Answers (3)

pragmateek
pragmateek

Reputation: 935

If you use the studio64 . command, your current folder will open in android studio.

This works if you've added the path of the bin directory of the android studio installation folder to environment variables. In my case, it is C:\Program Files\Android\Android Studio\bin.

This works the same as atom . or code .(VSCode)

The problem is, that it returns a bunch of warnings and stuff in the terminal before launching android studio. Also, if you close the terminal, the studio crashes.

It works but it's not purrfect.

Upvotes: 6

user14582824
user14582824

Reputation:

For Windows: Make a shortcut for your application and place in C:\WINDOWS\System32 you will be able to call it by the name of the shortcut. For Linux: echo $PATH

Upvotes: -1

On my winslow-7 machine there is an icon on the desktop named "Android studio".

I checked the properties of this icon, and in the destination field I've found:

"C:\Program Files\Android\Android Studio\bin\studio64.exe"

If I type that in a command prompt, Android studio opens normally.

A similar thing works in Linux too.

Basically, to run a program, you have to know where its executable resides; then you can ask the shell to run that executable. A few directories are searched automatically by the system and, if the executable resides in one of those directories, there is no need to indicate the full path - the name of the file suffices. The list of directories is an environment variable, PATH, for both windows and Linux.

This is a short and incomplete answer, though; your question asks a comparison and/or something more, but it is not clear and there would be a lot to say.

Upvotes: 9

Related Questions