This question's answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions.
Apparently, none of the Flutter commands are working in the terminal of Android Studio which I believe I am trying to run it at the root of my project.
Output:
bash: flutter: command not found
You need to correctly set up your Flutter path.
From macOS install - Update your path:
Determine the directory where you placed the Flutter SDK. You will need this in Step 3.
Open (or create) $HOME/.bash_profile. You can do that by using terminal text editor by going in terminal and typing nano ~/.bash_profile
macOS v10.15 (Catalina) uses the Z shell by default, so edit $file HOME/.zshrc.
If you are using a different shell, the file path and filename will be different on your machine.
Add the following line and change [PATH_TO_FLUTTER_GIT_DIRECTORY] to be the path where you cloned Flutter’s Git repository is:
export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH
For example:
export PATH=~/Documents/flutter/bin:$PATH
Press Ctrl + X and when it asks you to save the file, choose Yes
Run source $HOME/.bash_profile to refresh the current window or restart the terminal
Verify that the flutter/bin directory is now in your PATH by running:
echo $PATH
Notice that [PATH_TO_FLUTTER_GIT_DIRECTORY] is where you installed Flutter SDK, not the location of your app
Instead of nano, you can use any text editor to edit file ~/.bash_profile.
For zsh:
Open Terminal
Run: nano ~/.zshrc
Add: export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH
Run: source ~/.zshrc
restart terminal
Run: flutter doctor -v
For example : if flutter in your machine has been installed under [your_username]/Developer/flutter
export PATH=Developer/flutter/bin:$PATH
I tried out all the methods in previous answers, but all of them lasted only while the terminal was open. So I went ahead and directly added it to the path file permanently.
sudo nano /etc/paths
Add this to the file:
/Users/yourUserName/Development/flutter/bin
Save the file by pressing Ctrl + X, Y and then Enter. Close the terminal and reopen it again. Tada!
If you are using zsh, you need to follow the steps below on Mac.
Download the latest Flutter version from the official site.
Unzip it and move to the $HOME location of your Mac.
Add to the path via the .zshrc file.
Run nano ~/.zshrc into an iTerm2 terminal.
Export PATH=$HOME/flutter/bin:$PATH
Save and close the ~/.zshrc file.
Restart iTerm2.
Now you will have the Flutter executable available.
Do the following steps:
Download the Flutter SDK
Flutter SDK Archive
Extract it where do you want (for example /home/development/flutter)
Set your PATH. Edit your file with the command gedit ~/.profile. You need to add this line:
export PATH=[location_where_you_extracted_flutter]/flutter/bin:$PATH
I showed you above where I've extracted mine, so my export will look like this:
export PATH=/home/myUser/development/flutter/bin:$PATH
Save the file and close it.
Run source ~/.profile to load the changes
If you now run flutter doctor, it should work!
If you are on macOS
First find the location of your Flutter SDK
Flutter SDK File: Write the below command on your terminal to download the Flutter SDK
git clone https://github.com/flutter/flutter.git
For example: the SDK executable file name is flutter and it is in folder Downloads
Close and open your terminal again.
And enter the following commands in your terminal
cd Downloads # Go to Downloads
cd flutter # Go to folder 'flutter'
pwd # /Users/[USERNAME]/downloads/flutter/
whoami # Your [USERNAME]
export PATH="/Users/[USERNAME]/downloads/flutter/bin":$PATH
macOS v10.14 (Mojave); Wireshark Path problem
In your terminal, run:
touch $HOME/.bash_profile
vi $HOME/.bash_profile
Now use I to insert and paste the following:
export PATH="$PATH:$HOME:/PATH_TO_FLUTTER_GIT_DIRECTORY/flutter/bin"
Use Esc and type :wq! to save the file and exit.
Refresh:
source $HOME/.bash_profile
And verify it's OK by running:
echo $PATH
For zsh users:
Open terminal run
touch $HOME/.zshrc
Run
sudo nano ~/.zshrc
Type
export PATH=$PATH:/Path to your extracted flutter/Flutter/bin
Press ctrl+x then press y
Press Enter
Close the terminal and open a new terminal and run
flutter doctor
You must have the .bash_profile file and define the flutter path in the .bash_profile file.
First of all, if you do not have or do not know file .bash_profile, please look my answer:
How do I edit $PATH (.bash_profile) on OSX?
You should add the below line (.../flutter_SDK_path/flutter/bin) in your .bash_profile:
export PATH=$PATH:/home/username/Documents/flutter_SDK_path/flutter/bin
After these steps, you can write Flutter code such as, flutter doctor, flutter build ios, flutter clean, etc. in the terminal of a MacBook.
Do this to add the Flutter executable permanently to your path (in Ubuntu):
cd $HOME
gedit .bashrc
Append the line:
export PATH="$PATH:[location_where_you_extracted_flutter]/flutter/bin"
in the text file and save it.
source $HOME/.bashrc
Open new terminal and run the flutter doctor command
On macOS v10.15 (Catalina), the issue is with the Path environment variable.
Open Terminal and check the shell (command: echo $SHELL),
If output is /bin/bash, we need to convert to Z shell (Zsh). Z shell is only the default shell on newly created user accounts, so any existing accounts you have on an upgraded Mac will still use Bash by default unless you change it. Simply run the chsh -s (change shell) command in a Terminal window.
(command: chsh -s /bin/zsh)
Enter your password when prompted. After you close the terminal window and reopen it, you’ll be using Z shell.
Update your Path
2.1. Open the zshrc file (command: vim ~/.zshrc)
2.2. Press 'I' to insert the path as (export PATH=~/Dev/flutter/bin:$PATH). Here ~/Dev/ is the folder where Flutter is installed
2.3. Hit Esc key and then :wq to save and exit the file
Done! try (command: flutter doctor)
Previously I was giving my whole path like this:
export PATH=Users/Tekion/Downloads/flutter/bin:$PATH
It started working after I changed my whole path to
export PATH=$HOME/Downloads/flutter/bin:$PATH
Add Path in this way in .bashrc of android sdk and tools with flutter
export PATH=$PATH:/user/Android/Sdk/platform-tools:/user/Android/Sdk/build-tools/27.0.1:/user/Android/Sdk/tools:/user/Android/Sdk/tools/bin:/user/Documents/fluterdev/flutter/bin:$PATH
Then run this command
source ~/.profile
Then run this command:
On Linux
source ~/.profile
On Mac
source ~/.bash_profile
Or:
open -a TextEdit ~/.bash_profile
Then you can user any of flutter command like to build fluter apk
flutter build apk
The Flutter SDK can be run on Windows as well as macOS.
For Windows
First download the latest SDK from the Flutter download page.
Now to run flutter in the Windows console, you need to update your PATH environment variable.
From the Start search bar, type ‘env’ and select Edit environment variables for your account.
Under User variables, check if there is an entry called Path:
If the entry does exist, append the full path to flutter\bin using ; as a separator from the existing values.
If the entry does not exist, create a new user variable named Path with the full path to flutter\bin as its value.
For Mac
First download the latest SDK from the Flutter download page
Extract the file in the desired location using following commands:
cd ~/development
unzip ~/Downloads/flutter_macos_v1.5.4-hotfix.2-stable.zip
Add the Flutter tool to your path:
export PATH="$PATH:pwd/flutter/bin"
Run flutter doctor
I followed the checked answer, but when I restart the terminal, the Flutter command is not recognized again. My in file bash_profile path is:
export PATH=~/Users/aldo/Projects/Framework/flutter/bin:$PATH with ~
Then I edit it to:
export PATH=/Users/aldo/Projects/Framework/flutter/bin:$PATH without ~
And re run source $HOME/.bash_profile: Now my Flutter command is recognized even if I restart the terminal.
The Flutter installation issue in macOS (specific for macOS v11 (Big Sur)).
Check which shell is your default shell that you have in the terminal.
To check the default shell, type command echo $SHELL.
For my specific issue I have Z shell (zsh) as my default shell.
So I change my Z shell as my default shell to Bash.
To change the default shell, enter the below command.
chsh -s /bin/bash
Enter your password when you are prompted
Now I have the Bash shell as my default.
Then I just follow the standard process for the Flutter setup on Flutter’s official site.
And I have successfully configured Flutter in my macOS.
Extract the file in the desired location, for example:
cd ~/development
unzip ~/Downloads/flutter_macos_1.22.5-stable.zip
Add the flutter tool to your path:
export PATH="$PATH:`pwd`/flutter/bin"
This command sets your PATH variable for the current terminal window only. To permanently add Flutter to your path, see below.
—> Determine the directory where you placed the Flutter SDK.
—> Open (or create) the rc file for your shell. Typing echo $SHELL in your Terminal tells you which shell you’re using. If you’re using Bash, edit $HOME/.bash_profile or $HOME/.bashrc. If you’re using Z shell, edit $HOME/.zshrc. If you’re using a different shell, the file path and filename will be different on your machine.
—> Add the following line and change [PATH_TO_FLUTTER_GIT_DIRECTORY] to be the path where you cloned Flutter’s Git repository
export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin"
—> Run source $HOME/.<rc file> to refresh the current window, or open a new terminal window to automatically source the file.
—> Verify that the flutter/bin directory is now in your PATH by running:
echo $PATH
—> Verify that the flutter command is available by running
—> which flutter
—> Now run below command.
$ which flutter dart
/path-to-flutter-sdk/bin/flutter
/usr/local/bin/dart
—> And you're good to go.
You can easily create a symbolic link as below,
sudo ln -s /opt/flutter/bin/flutter /usr/bin/flutter
I had moved the executable flutter into the /opt/ folder after downloading, so replace it with the path you have for the directory the flutter executable is in.
The flutter command should work even after rebooting your machine.
In my case, I put the line export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH in both file .bash_profile and .bashrc (I put it on the last line).
After that, run source .bash_profile and source .bashrc. Now it's working (even if you use it in a new terminal window)!
Just revert to chsh -s /bin/bash from chsh -s /bin/zsh,
Run one command
chsh -s /bin/bash
You're facing this problem just because you have changed the shell from Bash to Z shell in macOS. If you run this command again it will change the path again.
So just run one command and the problem is solved.
For Ubuntu 14.*:
There isn't any .bash_profile file, but it just the .profile file in folder /home/mangesh.
In my case, I am running this command to add the flutter/bin path,
export PATH="$PATH:/home/mangesh/Documents/flutter_data/flutter/bin/"
To verify the above change, just run,
echo $PATH
Following is my complete output,
$ pwd
/home/mangesh
$ export PATH="$PATH:/home/mangesh/Documents/flutter_data/flutter/bin/"
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/mangesh/Documents/flutter_data/flutter/bin/
On a Mac I followed the steps of the user Tree, but I still received the answer "flutter: command not found".
I then went to the folder flutter/bin and inside this folder Ctrl + click on the flutter executable and in the popup I clicked open. After that the Mac already recognized this as an exception and the Flutter commands already work.
On a Mac, there are two options to solve this issue.
Option 1: Adding the Flutter SDK path permanently (it will work in any terminal session)
Download the Flutter SDK and extract in any location and then you have to add the below line in $HOME/.bash_profile file (hidden folder as default).
export PATH="$PATH:[where the Flutter SDK is downloaded and extracted]/flutter/bin"
For example:
export PATH="$PATH:~/development/tools/flutter/bin"
Option 2: If you are facing any difficulties with Option 1, then this is much simpler, but you have to do this simple step whenever you restart your system/terminal.
Step 1: Go to the path where Flutter SDK downloaded and extracted (for example: cd ~/Development/tools/)
Step 2: Enter this command
export PATH='pwd'/flutter/bin:$PATH
That's it. Type "flutter doctor" to check if this issue gets resolved.
First, download the Flutter here: https://flutter.dev/docs/get-started/install/macos
When you created the folder with Flutter SDK, open it in Terminal using the following command:
cd ~/development
If there is no development folder run this command first:
mkdir /development
After that, you need to run the unzip command. Make sure you specify the correct path to the downloaded Flutter archive file.
Run the command below:
unzip ~/Downloads/flutter_macos_1.17.1-stable.zip
Setting the Flutter tool path
In order to set up the Flutter tool path you should run this command:
export PATH="$PATH:`pwd`/flutter/bin"
Next, you need to know which shell you are using. For this run this command:
echo $SHELL
Depending on the shell run the following command: [Note, the command you will be using depends on the shell you have.]
sudo nano ~/.zshrc
or
sudo nano /.bashrc
After that in the new window, you need to add a path to the flutter tool.
Use the following command:
export PATH=$PATH:~/development/flutter/bin
The next thing you need to do is to check the Flutter dependencies.
For this, run the command:
flutter doctor
This operation will help you to identify if there are any dependencies you need to install.
After the results will be prepared click Agree and wait for the installation of the needed dependencies to complete the setup.
enter image description here
Ubuntu 16.04 (Xenial Xerus):
I added the path correctly for Flutter, Java, Android Studio, and Android SDK in the .bashrc file, but when I run flutter doctor, the terminal returns:
flutter: command not found
Solution:
So, first I had to always run:
sudo su
And then:
source /home/your_name/.bashrc
Then run flutter doctor. It works fine.
So every time, if I want to run flutter doctor, I have to run these two commands above.
The Flutter installation guide says you add this:
export PATH="$PATH:pwd/flutter/bin"
Visual Studio Code doesn't support pwd for some reason. The fix:
export PATH="$PATH:~/flutter/bin"
If you are facing this issue from a Windows 10 machine, this is how I solved it:
First of all, find your Flutter executable path, and then your bin folder under the Flutter path
E.g., "C:\flutter\bin"
Copy it, and press the windows button. Type: environment, and press "Edit the system environment variable"
Press the "Environment variable" button
Double click on the "Path" menu
Add a new path, using the bin address
E.g., ""C:\flutter\bin"
This should work.
For those using a Z shell resource (.zshrc), navigate to your home directory and open .zprofile, copy and paste this: export PATH=[PATH_TO_FLUTTER_DIRECTORY]/flutter/bin:$PATH
I've been trying to set a flutter path so I don't need to do a temporary path every single time. I'm new to using terminal and Unix (Mac user also) and don't understand how to set my path with the instructions on the site. And it doesn't help that I'm not completely sure where I out my flutter sdk. Would like to know step by step what to do.
I'm using Ubuntu 18.04 LTS. Assuming you have successfully downloaded and extracted flutter_linux_v0.5.1-beta.tar.xz (latest update until now) onto your preferred directory.
export PATH=`pwd`/flutter/bin:$PATH
Running this command in your ubuntu terminal (Ctrl + Alt + T) adds flutter commands PATH variable to your system path for temporary session. As soon as you close the terminal, the system path is removed.
In order for ubuntu terminal to remember flutter commands permanently, you need to:
1.) open up terminal and cd to $HOME. for eg: user#linux:~$
2.) open the hidden file .bashrc with your desired editor. It resides in $HOME.
3.) add the following line
export PATH=/home/yourname/flutter/bin:$PATH
somewhere as a newline in .bashrc file preferably as a last line edit & save file.
4.) run source /home/yourname/.bashrc in terminal to process your recent changes.
5.) finally, run echo $PATH to see flutter dir is in your system path along with other such paths. for eg: /home/yourname/flutter/bin
Now close current terminal and reopen new terminal to check flutter doctor. It should process along with all other available flutter commands everytime now onwards. Thank you ! :)
Windows
Refer to this tutorial https://www.java.com/en/download/help/path.xml
Mac OS
Open or create one the following files:
~/.profile (Compatible with MacOS Catalina) .bash_profile (Only if your Terminal uses Bash) add the following line at the bottom.
export PATH=$PATH:/flutter/bin
Linux
Open or create ~/.bash_profile add the following line at the bottom.
export PATH=$PATH:/flutter/bin
Linux (Ubuntu 19.04)
Open ~/.bashrc add the following line at the bottom: (your path may be different)
export PATH=$PATH:~developement/flutter/bin
For further documentation
https://flutter.io/docs/get-started/install/macos#update-your-path
export PATH=`pwd`/flutter/bin:$PATH
I had the same issue when i am working VS Code / flutter with ubuntu OS. every time shows the message flutter: command not found . Then i set the path through VS Code integrated terminal. Please see the below screenshot.
open a terminal window and write command
vim ~/.bash_profile
Write this in the file.
alias flutter="~/flutter/bin/flutter"
if you have extracted flutter in your root (~) folder.
save this and run this command in terminal.
source ~/.bash_profile
Now you are done.
I'm using macOS Catalina version- 10.15.7 and I have updated my $PATH variable by following those steps:
Optional: Type echo $SHELL in your terminal. It will tell you which shell you are using. macOS Catalina uses Z shell by default.
Output: /bin/zsh
Optional: Type echo $PATH in your terminal and hit enter. It will show you the existing paths you have already set as path variable.
Output: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin
As i'm using Z shell i have to open the .zshrc file. In my case i'm using vim editor. You can also use nano or atom editor. For opening the file type vi ~/.zshrc in your terminal.
Type i for Insert mode.
Type export PATH="$PATH:[your_flutter_sdk_path_here]/flutter/bin"
To save the file in Vim/vi, press Esc key then type :w and hit Enter key.
To quit Vim/vi by press Esc key then type :x and hit Enter key.
Finally you need a dot notation to activate it. Type . ~/.zshrc in your terminal.
Now you can check your path variable by typing echo $PATH in your terminal and hiting enter key.
Output: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin:/Users/user/Documents/flutter/bin
Verify that the flutter command is available by running which flutter in your terminal.
Output: /Users/user/Documents/flutter/bin/flutter
You can add the Flutter path to the system path or to your ~/.profile file.
This will help you as it has more detailed instructions, difference on using .profile vs .bashrc and usage on different shells.
https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path
it depends what shell you use,if you use bash,you can edit ~/.bash_profile,add environment variable as export PATH=xxx/flutter/bin:$PATH;if use zsh,you should edit ~/.zshrc ,add environment variable as export PATH=xxx/flutter/bin:$PATH
For bash profile users
Step 1: open terminal and type
vim ~/.bash_profile
Step 2: Type this command (modify your folder path)
Note: I added one new folder(FlutterSDK) in my username
export PATH="$PATH:$HOME/FlutterSDK/flutter/bin"
Step 3: Press esc
Step 4: type :wq! command to save this bash file
:wq!
Step 5: Close current terminal window & open new window
Step 6: To verify type flutter version command
flutter --version
Flutter Path Setup in MAC
Before Setup Clone the git Flutter Folder using below Command
==> git clone https://github.com/flutter/flutter.git -b stable
Step 1: Copy the Path of " Git Flutter Folder" and make PATH variable like below
==> export PATH="$PATH:/Users/myhome/Desktop/Flutter/bin"
Step 2: type "echo $SHELL" in terminal.It will show the type of shell which is using in your Mac
Step 3: If it is bash, type "open .bash_profile" in terminal to open the hidden "rc" file
step 4: once opened, copy the Path variable from step 1 and paste it in .bash_profile file
Step 5: save the file
Step 6:run ==> source $HOME/.bash_profile
Step 7: Now check your path got updated by ==> echo $PATH command
Step 8:once it got listed run ==> Flutter Doctor
Step 9: If error occurs like "flutter commands not found" then "RESTART" your Mac
Now try Flutter Doctor it will work
I tried to run an ADB command in the Android Studio terminal. However I got the following error:
adb is not recognized as an internal or external command
First I turned on ADB integration under Tools > Android menu. Then I tried adding the platform-tools folder to a Path variable under Settings > Appearance & Behavior > Path Variables to no success. (I restarted AS after the change as you would a shell.)
I know an easy fix would be to change my OS path variable, but I would like to avoid doing that. So the question becomes: is there any way to get Android Studio to recognize the command in it's terminal via the settings?
Note and opinion: This happens out of a fresh install of 3.0.1. It seems a little silly to me if the software installs the SDK & tools that it would not have the commands working out of the box in the terminal.
Option 1
• Create a new file, copy paste these 2 lines:
PATH %PATH%;C:\Users\Example\AppData\Local\Android\Sdk\platform-tools
cmd /k "cls"
The path to the adb.exe is just an example. You have to find the correct path first, and use that instead of C:\Users\Example\AppData\Local\Android\Sdk\platform-tools.
• Save the file with .bat extension, e.g. cmdWithAutoUpdatedTempPath.bat.
• Move the file where you want, e.g. C:\Users\Example\AppData\Local\Android.
• In Android Studio, go to File ▸ Settings... ▸ Tools ▸ Terminal and set the Shell path to C:\Users\Example\AppData\Local\Android\cmdWithAutoUpdatedTempPath.bat
The name of the file and the path to it is just an example. You have to use the values from the previous two steps, instead of C:\Users\Example\AppData\Local\Android\cmdWithAutoUpdatedTempPath.bat.
Option 2
In Android Studio, go to File ▸ Settings... ▸ Tools ▸ Terminal and set the Start directory to C:\Users\Example\AppData\Local\Android\Sdk\platform-tools
The path to the adb.exe is just an example. You have to find the correct path first, and use that instead of C:\Users\Example\AppData\Local\Android\Sdk\platform-tools.
Option 3
Update the path variable by using this command in the terminal, each time a new session is created:
PATH %PATH%;C:\Users\Example\AppData\Local\Android\Sdk\platform-tools
The path to the adb.exe is just an example. You have to find the correct path first, and use that instead of C:\Users\Example\AppData\Local\Android\Sdk\platform-tools.
The adb tool is located at
C:\Users\<YOUR PC USER NAME>\AppData\Local\Android\Sdk\platform-tools
On a windows system to access adb from anywhere (android studio,vscode,cmd etc) you need to add this path to the environment variable of your system.
for this
search environment variables
go to user variables section and edit path
add new path under key PATH and paste the above path
reopen the application (android studio/cmd/vscode) where you want to access adb, and try typing adb in the cmd ,you will have access to all the adb features.
on windows:
If you have installed the software in its default folder, please follow the instructions below:
type:
cd C:\Users\<YOUR PC USER NAME>\AppData\Local\Android\Sdk\platform-tools
YOUR PC USER NAME - is your pc user name (without <> )
after that, please connect device and try adb by typing:
adb devices
If you are using Windows 10, then go to Environmental Variables, Click on New
A new Window will open which will have two fields
Variable Name
Variable Value
Variable Name: Path
Variable Value: C:\Users<Your PC name>\AppData\Local\Android\Sdk\platform-tools
Hit on Ok then Restart Android Studio
For Connect wireless Android Device then follow this simple steps:
Step 1:
Attach Android Mobile Device with Cable.
and make sure mobile and computer must be in Same Network.
Step 2:
Open Android Studio and open TERMINAL phase in it. (which is located at left bottom).
Step 3:
Provide path of SDK location.
Ex: C:\Users\Admin\AppData\Local\Android\Sdk\platform-tools>
Step 4:
Provide ADB Connection command:
--> adb tcpip 5555
ex: C:\Users\Admin\AppData\Local\Android\Sdk\platform-tools> adb tcpip 5555 [Press Enter Button]
if all aboves step is properly executed then you got Output like:
Step 5:
Here, got your mobile IP address.
(we got this if mobile device connected via WIFI and make sure computer connected same WIFI )
and at last make device connection wireless so put this command:
--> adb connect 192.168.1.5
ex: C:\Users\Admin\AppData\Local\Android\Sdk\platform-tools> adb connect 192.168.1.5 [Press Enter Button]
and the final ouput:
connected to 192.168.1.5:5555
☻♥ Done Keep Code
if you are using windows 10 or 11
Search Environment Variables
You will System property dialog
Select Environment Variables describe in Step 1 Environment
Variables Screenshot
Now Select Path describe in Step 2 Path Screenshot
Edit this edit screenshot
Click new and add address %USERPROFILE%\AppData\Local\Android\Sdk\platform-tools to your adb executable file copy past address
Is there a way to launch Microsoft Visual Studio Code from the command line in windows? I can't even seem to find the directory for code on my computer. It didn't even ask me where to download it.
Navigate to the directory that you want to open and type code . to launch VS Code.
As many folks already suggested ways to open code from command prompt using code . command. This will only open Visual Studio Code Stable build. But If you have downloaded Visual Studio Code Insider build/version (Which has all latest build/features but unstable version) then you need to follow below instructions in windows :
Go to Control Panel\System and Security\System. Click on Advanced System Settings
Click on Environment Variables
Under System Variables tab, Click on Edit for Path Variable
Add a new path C:\Users\tsabu\AppData\Local\Programs\Microsoft VS Code Insiders\bin
(or)
C:\Program Files\Microsoft VS Code Insiders\bin based on location at which you have installed vscode insider in your machine.
Open a new command prompt and type code-insiders . to open vscode-insider
build/version
Short answer:
code your_path your_filename
Long answer:
Here your_path can simply be . if you want to use the current directory as your working path. Or .. for 1 level up, etc.
code is the name of the executable of Visual Studio Code (code.exe). If it doesn't launch, perhaps your VSC path hasn't been added to the path environment variable. Run this command to add it:
set PATH=";C:\Program Files\Microsoft VS Code\bin"
Of course you'll need to specify a different path if your VSC is installed somewhere else.
How can you find out the installation path? (click for screenshot) Go to "Start" menu, type in "Visual Studio Code", right click on the found program, "Properties", check "Target". Now you'll see!
It may come already added to your path when installed. Try using code <filename> in your command line. If it's not you can add the command line script's directory to your path. The command line script's directory is downloaded by default in the following location
C:\Users\<username>\AppData\Local\Code\bin
Point your command prompt to the specific folder that has the file that you want to open. Let's say you want to open the file titled main.scss. Simply run this command:
start code main.scss
If Visual Studio Code is already open, you can simply do:
code main.scss