Как открыть терминал в visual studio code
When using Visual Studio Code, how do I run command-line programs, such as a choco (Chocolatey) command? Do I need to have a separate Command Line (CMD.exe) running outside VS Code, or is there a hotkey/window within Code where I can run those commands?
I see the "Command Palette", but it is not entirely clear what command engines run in that palette.
Somewhat related note: I was having trouble opening the native console ( workbench.action.terminal.openNativeConsole in Keyboard Shortcuts, Open New Terminal in Command Palette), and I found out it was because I needed to first open a folder in vscode. The new console is opened with the current working directory set to the workspace directory in vscode, so I imagine that's why it wouldn't open without choosing a folder first.
18 Answers 18
For integrated console use Ctrl + `
From the release notes:
With the May release, we are rolling out the initial version of an integrated terminal. You can open the terminal using Ctrl+`, from the View | Toggle Integrated Terminal menu, or from the View > Toggle Integrated Terminal command in the Command Palette.
My version at work has an optionon the right click context menu to open the terminal, similar to "Open in Command Prompt", but my version at home doesn't have this option. I shall investigate
Use CMD+Shift+C or CTRL+Shift+C but it will only open a new outside editor standard bash console.
I hope they will implement an integrated console.
And I agree, I wish it was integrated, but that hotkey works great. Opened right up into the project folder I was using. Thanks again!
There's an "Open New Command Prompt (Ctrl+Shift+C)" entry in Command Palette but it doesn't do anything at all, not at least on Windows 10.
Can open it with this menu options: View > Integrated Terminal
Default keyboard shortcut for integrated terminal is Ctrl + `
In vscode you can use multiple integrated terminals.
If you want open another one use Ctrl + Shift + `
vscode keys shortcuts are rendered assuming a standard US keyboard layout. If you use a different keyboard layout, please read how can see the representation in your current keyboard. It's easy, open this menu options: File > Preferences > Keyboard Shortcuts and on the Default Keyboard Shortcut search the command workbench.action.terminal.toggleTerminal then point you mouse to info icon and can see the combination. For me is Ctrl + ñ because I'm using Spanish keyboard layout.
Also it's cool create an personal shortcuts to toggle into terminals. Open this menu options: File > Preferences > Keyboard Shortcuts and on the keybinding.json tab put this:
Now when the cursor are focus on terminal, and have more than one terminal, you can navigate through every one with the combinations Ctrl + Page Down for previous terminal and Ctrl + Page Up for next terminal.
Tip: If you are focus on the editor, the same keyboard shortcuts can be used to navigate through tabs.
Visual Studio Code has a powerful command-line interface built-in that lets you control how you launch the editor. You can open files, install extensions, change the display language, and output diagnostics through command-line options (switches).
If you are looking for how to run command-line tools inside VS Code, see the Integrated Terminal.
Command line help
To get an overview of the VS Code command-line interface, open a terminal or command prompt and type code --help . You will see the version, usage example, and list of command line options.
Launching from command line
You can launch VS Code from the command line to quickly open a file, folder, or project. Typically, you open VS Code within the context of a folder. To do this, from an open terminal or command prompt, navigate to your project folder and type code . :
Note: Users on macOS must first run a command (Shell Command: Install 'code' command in PATH) to add VS Code executable to the PATH environment variable. Read the macOS setup guide for help.
Windows and Linux installations should add the VS Code binaries location to your system path. If this isn't the case, you can manually add the location to the Path environment variable ( $PATH on Linux). For example, on Windows, VS Code is installed under AppData\Local\Programs\Microsoft VS Code\bin . To review platform-specific setup instructions, see Setup.
Insiders: If you are using the VS Code Insiders preview, you launch your Insiders build with code-insiders .
Core CLI options
Here are optional arguments you can use when starting VS Code at the command line via code :
Argument | Description |
---|---|
-h or --help | Print usage |
-v or --version | Print VS Code version (for example, 1.22.2), GitHub commit ID, and architecture (for example, x64). |
-n or --new-window | Opens a new session of VS Code instead of restoring the previous session (default). |
-r or --reuse-window | Forces opening a file or folder in the last active window. |
-g or --goto | When used with file:line[:character], opens a file at a specific line and optional character position. This argument is provided since some operating systems permit : in a file name. |
-d or --diff | Open a file difference editor. Requires two file paths as arguments. |
-w or --wait | Wait for the files to be closed before returning. |
--locale | Set the display language (locale) for the VS Code session. (for example, en-US or zh-TW ) |
Opening Files and Folders
Sometimes you will want to open or create a file. If the specified file does not exist, VS Code will create them for you along with any new intermediate folders:
For both files and folders, you can use absolute or relative paths. Relative paths are relative to the current directory of the command prompt where you run code .
If you specify more than one file at the command line, VS Code will open only a single instance.
If you specify more than one folder at the command line, VS Code will create a Multi-root Workspace including each folder.
Argument | Description |
---|---|
file | Name of a file to open. If the file doesn't exist, it will be created and marked as edited. You can specify multiple files by separating each file name with a space. |
file:line[:character] | Used with the -g argument. Name of a file to open at the specified line and optional character position. You can specify multiple files in this manner, but you must use the -g argument (once) before using the file:line[:character] specifier. |
folder | Name of a folder to open. You can specify multiple folders and a new Multi-root Workspace is created. |
Working with extensions
You can install and manage VS Code extensions from the command line.
Argument | Description |
---|---|
--install-extension | Install an extension. Provide the full extension name publisher.extension as an argument. Use --force argument to avoid prompts. |
--uninstall-extension | Uninstall an extension. Provide the full extension name publisher.extension as an argument. |
--disable-extensions | Disable all installed extensions. Extensions will still be visible in the Disabled section of the Extensions view but they will never be activated. |
--list-extensions | List the installed extensions. |
--show-versions | Show versions of installed extensions, when using --list-extensions |
--enable-proposed-api | Enables proposed api features for an extension. Provide the full extension name publisher.extension as an argument. |
Advanced CLI options
There are several CLI options that help with reproducing errors and advanced setup.
Argument | Description |
---|---|
--extensions-dir | Set the root path for extensions. Has no effect in Portable Mode. |
--user-data-dir | Specifies the directory that user data is kept in, useful when running as root. Has no effect in Portable Mode. |
-s, --status | Print process usage and diagnostics information. |
-p, --performance | Start with the Developer: Startup Performance command enabled. |
--disable-gpu | Disable GPU hardware acceleration. |
--verbose | Print verbose output (implies --wait ). |
--prof-startup | Run CPU profiler during startup. |
--upload-logs | Uploads logs from current session to a secure endpoint. |
Multi-root | |
--add | Add folder(s) to the last active window for a multi-root workspace. |
Opening VS Code with URLs
You can also open projects and files using the platform's URL handling mechanism. Use the following URL formats to:
Open a file to line and column
You can use the URL in applications such as browsers or file explorers that can parse and redirect the URL. For example, on Windows, you could pass a vscode:// URL directly to the Windows Explorer or to the command line as start vscode:// .
Note: If you are using VS Code Insiders builds, the URL prefix is vscode-insiders:// .
Next steps
Read on to find out about:
-
- Run command-line tools from inside VS Code. - Learn the basics of the VS Code editor. - VS Code lets you quickly understand and move through your source code.
Common questions
'code' is not recognized as an internal or external command
Your OS cannot find the VS Code binary code on its path. The VS Code Windows and Linux installations should have installed VS Code on your path. Try uninstalling and reinstalling VS Code. If code is still not found, consult the platform-specific setup topics for Windows and Linux.
On macOS, you need to manually run the Shell Command: Install 'code' command in PATH command (available through the Command Palette ⇧⌘P (Windows, Linux Ctrl+Shift+P ) ). Consult the macOS specific setup topic for details.
How do I get access to a command line (terminal) from within VS Code?
VS Code has an Integrated Terminal where you can run command-line tools from within VS Code.
Can I specify the settings location for VS Code in order to have a portable version?
Not directly through the command line, but VS Code has a Portable Mode, which lets you keep settings and data in the same location as your installation, for example, on a USB drive.
Visual Studio включает две оболочки командной строки для разработчиков, командную строку и экземпляр PowerShell, как показано ниже.
Командная строка разработчика для Visual Studio — стандартная командная строка с определенными переменными среды, упрощающая работу с инструментами разработки. Доступно с версии Visual Studio 2015.
PowerShell для разработчиков Visual Studio — более функциональное средство, чем командная строка. Например, в нем можно передать результат одной команды (называемой cmdlet ) в другой cmdlet. В этой оболочке доступны те же переменные среды, что и в Командной строке разработчика. Доступно с версии Visual Studio 2019.
Начиная с версии 16.5, в Visual Studio 2019 доступен встроенный терминал, где можно работать как с Командной строкой разработчика, так и с PowerShell для разработчиков. Можно открыть несколько вкладок для каждой оболочки. Терминал Visual Studio построен на основе Терминала Windows. Чтобы открыть терминал в Visual Studio, выберите элементы Вид > Терминал.
При запуске в Visual Studio одной из оболочек как отдельного приложения или в окне терминала открывается каталог текущего решения (если оно загружено). Это упрощает выполнение команд для решения или его проектов.
В обеих оболочках заданы определенные переменные среды. Это упрощает работу с инструментами командной строки. Открыв эти оболочки, можно выполнять команды для различных служебных программ, не указывая их расположения.
Запуск в Visual Studio
Выполните следующие действия, чтобы открыть в Visual Studio Командную строку разработчика или PowerShell для разработчиков:
Запустите Visual Studio.
В строке меню выберите элементы Инструменты > Командная строка > Командная строка разработчика или PowerShell для разработчиков.
Запуск из меню Windows
Другой способ запуска оболочек — из меню "Пуск". В зависимости от версии Visual Studio, дополнительно установленных пакетов SDK и рабочих нагрузок может иметься несколько вариантов командных строк.
Windows 11
Выберите для приложения результат, связанный с текстом поиска.
Windows 10
Разверните папку Visual Studio 2019 или Visual Studio 2022.
Если вы используете Visual Studio 2019, выберите Командная строка разработчика для VS 2019 или PowerShell для разработчиков для VS 2019. Если используется Visual Studio 2022, выберите Командная строка разработчика для VS 2022 или PowerShell для разработчиков для VS 2022.
Кроме того, вы можете начать вводить имя оболочки в поле поиска на панели задач и выбрать нужный результат, так как в списке результатов начнут отображаться найденные совпадения.
Windows 8.1
Перейдите на экран Пуск, нажав клавишу с логотипом Windows на клавиатуре, например.
На начальном экране нажмите Ctrl+Tab, чтобы открыть список приложений, а затем нажмите V. Появится список, включающий все установленные командные строки Visual Studio.
Если вы используете Visual Studio 2019, выберите Командная строка разработчика для VS 2019 или PowerShell для разработчиков для VS 2019. Если используется Visual Studio 2022, выберите Командная строка разработчика для VS 2022 или PowerShell для разработчиков для VS 2022.
Windows 7
Выберите Пуск а затем разверните Все программы.
Выберите элементы Visual Studio 2019 > Инструменты Visual Studio > Командная строка разработчика для VS 2019 или PowerShell для разработчиков для VS 2019. (Если вы используете Visual Studio 2022, найдите те же элементы, которые содержат "2022" вместо "2019".)
Если установлены другие пакеты SDK, например, пакет SDK для Windows 10 или предыдущих версий, могут появиться дополнительные командные строки. Требуемая версия командной строки указана в документации по соответствующим инструментам.
Запуск из обозревателя файлов
Обычно ярлыки для установленных оболочек помещаются в папку меню "Пуск" для Visual Studio, например в %ProgramData%\Microsoft\Windows\Start Menu\Programs\Visual Studio 2019\Visual Studio Tools. Но если поиск командной строки не дает ожидаемых результатов, попробуйте вручную найти нужные файлы на компьютере.
Командная строка разработчика
Выполните поиск файла командной строки (VsDevCmd.bat) или перейдите в папку "Инструменты" Visual Studio ( %ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\Common7\Tools — путь зависит от версии Visual Studio, выпуска и расположения установки).
Когда вы найдете файл командной строки, откройте его. Для этого введите следующую команду в стандартном окне командной строки:
Кроме того, вы можете ввести следующую команду в диалоговом окне Windows Выполнить:
Не забудьте изменить путь в соответствии с используемой версией Visual Studio.
PowerShell для разработчиков
Найдите файл скрипта PowerShell с именем Launch-VsDevShell.ps1 или перейдите в папку "Инструменты" Visual Studio ( %ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\Common7\Tools). Путь зависит от версии, выпуска и расположения установки Visual Studio. После этого выполните следующую команду в командной строке Windows PowerShell или PowerShell 6:
По умолчанию PowerShell для разработчиков запускается с конфигурацией для той версии Visual Studio, путь установки к которой указан в файле Launch-VsDevShell.ps1.
Чтобы выполнить cmdlet, нужно задать политику выполнения.
Скрипт Launch-VsDevShell.ps1 находит модуль PowerShell Microsoft.VisualStudio.DevShell.dll в каталоге установки Visual Studio, скачивает модуль и вызывает командлет Enter-VsDevShell cmdlet. Установленные ярлыки, как в меню "Пуск", будут загружать модуль и вызывать cmdlet напрямую. Использование Launch-VsDevShell.ps1 — это рекомендуемый способ инициализации PowerShell для разработчиков в интерактивном режиме или автоматизации сборки скрипта.
аргументов командной строки;
Можно использовать аргументы командной строки для любой из оболочек, «Командная строка разработчика» или «PowerShell для разработчика».
Целевая архитектура и архитектура узла
Для средств сборки (таких как компилятор C++), которые создают выходные данные, предназначенные для конкретных архитектур ЦП, оболочки разработки можно настроить с помощью определенного аргумента командной строки. Архитектуру двоичных файлов средства сборки также можно настроить с помощью аргументов командной строки. Это полезно, если архитектура компьютера сборки отличается от целевой архитектуры.
Начиная с Visual Studio 2022, для msbuild по умолчанию будет использоваться 64-разрядный двоичный файл msbuild.exe, независимо от архитектуры узла.
Shell | Аргумент |
---|---|
Командная строка разработчика | -arch= |
Командная строка разработчика | -host_arch= |
PowerShell для разработчиков | -Arch |
PowerShell для разработчиков | -HostArch |
Аргументы -Arch и -HostArch в PowerShell для разработчика доступны только начиная с версии Visual Studio 2022 с обновлением 17.1.
Ниже приведена таблица со списком поддерживаемых архитектур. В нем также указано, можно ли их использовать для аргументов целевой архитектуры или архитектуры узла.
Архитектура | Целевая архитектура | Архитектура узла |
---|---|---|
x86 | По умолчанию | По умолчанию |
amd64 | Да | Да |
arm | Да | Нет |
arm64 | Да | Нет |
Если задана только целевая архитектура, оболочки будут пытаться сопоставить с ней архитектуру узла. Поэтому, если настроена только целевая архитектура со значением, не поддерживаемым для архитектуры узла, могут возникнуть ошибки.
Примеры
Запустите Командную строку разработчика для Visual Studio 2019 Community Edition на 64-разрядном компьютере, создав выходные данные сборки, предназначенные для 64-разрядной архитектуры:
Запустите Командную строку разработчика для Visual Studio 2019 Community Edition на 64-разрядном компьютере, создав выходные данные сборки, предназначенные для ARM:
Запустите PowerShell для разработчиков для версии Community Edition Visual Studio 2022 17.1 или более поздней версии на 64-разрядном компьютере, создав выходные данные сборки, предназначенные для arm64:
SkipAutomaticLocation
Начальный каталог оболочки PowerShell для разработчика — это расположение проекта Visual Studio. Этот язык по умолчанию переопределяет все остальные пути, например к рабочему каталогу. Такое поведение можно отключить с помощью аргумента командной строки -SkipAutomaticLocation . Это полезно, если, например, вы хотите, чтобы в оболочке использовался текущий каталог после инициализации.
Расположение проекта можно настроить в меню Средства > Параметры > Проекты &и решения > Расположение проекта.
Аргументы командной строки -Arch , -HostArch и -SkipAutomaticLocation поддерживаются скриптом Launch-VsDevShell.ps1 и командлетом Enter-VsDevShell cmdlet.
Предварительные требования
Создание приложения
Запустите Visual Studio Code.
В главном меню выберите Файл>Открыть папку (в macOS выберите File>Open. (Файл > Открыть)).
В диалоговом окне Открыть папку создайте папку HelloWorld и выберите ее. Затем щелкните Выбрать папку (или Открыть в macOS).
Имя папки по умолчанию преобразуется в имя проекта и имя пространства имен. Вы добавите код позже в этом учебнике. Предполагается, что пространство имен проекта — HelloWorld .
В диалоговом окне о доверии авторам файлов в этой папке выберите Да, я доверяю авторам.
Откройте терминал в Visual Studio Code, выбрав в основном меню пункт Вид>Терминал.
Откроется окно Терминал с командной строкой в папке HelloWorld.
В окне терминала введите следующую команду:
Шаблон проекта создает простое приложение, которое отображает "Hello World" в окне консоли, вызывая метод Console.WriteLine(String) из файла Program.cs.
Замените содержимое Program.cs кодом из этого примера.
При первом редактировании файла .cs в Visual Studio Code будет предложено добавить недостающие ресурсы для сборки и отладки приложения. Выберите Да и Visual Studio Code создаст папку .vscode с файлами launch.json и tasks.json.
Если запрос не отображается или вы случайно закрываете его без нажатия кнопки "Да", выполните следующие действия, чтобы создать launch.json и tasks.json:
- Выберите "КонфигурацияRunAdd>" в меню.
- Выберите .NET 5+ и .NET Core в командной строке "Выбор среды ".
Код определяет класс Program с одним методом Main , который принимает массив String в качестве аргумента. Main — точка входа в приложение. Это метод, который автоматически вызывается средой выполнения при запуске приложения. Все аргументы, предоставленные в командной строке при запуске приложения, доступны через массив args.
Запуск приложения
Выполните следующие команды в окне терминала:
Программа отображает "Hello World!" и заканчивается.
Улучшение приложения
Давайте расширим приложение. Теперь у пользователя будет запрашиваться имя, которое затем будет отображаться с датой и временем.
Откройте файл Program.cs.
В Program.cs замените содержимое метода Main (строка, вызывающая Console.WriteLine ) следующим кодом:
Этот код отображает запрос в окне консоли и ожидает, чтобы пользователь ввел строку текста и нажал клавишу ВВОД . Приложение сохраняет полученную строку в переменной с именем name . Оно также получает значение свойства DateTime.Now, которое содержит текущее локальное время, и присваивает его переменной с именем currentDate . Затем оно отображает эти значения в окне консоли. Наконец, приложение выводит запрос в окне консоли и вызывает метод Console.ReadKey(Boolean) для ожидания ввода данных пользователем.
Знак доллара ( $ ) перед строкой позволяет вставить такие выражения, как имена переменных, в фигурные скобки в строке. Значение выражения вставляется в строку вместо выражения. Такой синтаксис называется интерполированными строками.
В Visual Studio Code необходимо явно сохранить изменения. В отличие от Visual Studio, изменения файлов не сохраняются автоматически при сборке и запуске приложения.
Запустите программу еще раз:
В ответ на приглашение в командной строке введите имя и нажмите клавишу ВВОД .
Нажмите любую клавишу для выхода из программы.
Дополнительные ресурсы
Следующие шаги
Предварительные требования
Создание приложения
Запустите Visual Studio Code.
В главном меню выберите Файл>Открыть папку (в macOS выберите File>Open. (Файл > Открыть)).
В диалоговом окне Открытие папки создайте папку HelloWorld и щелкните Выбрать папку (в macOS щелкните Open (Открыть)).
Имя папки по умолчанию преобразуется в имя проекта и имя пространства имен. Вы добавите код позже в этом учебнике. Предполагается, что пространство имен проекта — HelloWorld .
Откройте терминал в Visual Studio Code, выбрав в основном меню пункт Вид>Терминал.
Откроется окно Терминал с командной строкой в папке HelloWorld.
В окне терминала введите следующую команду:
Этот шаблон создает простое приложение Hello World. Он вызывает метод Console.WriteLine(String) для вывода "Hello World!" в окне консоли.
Код шаблона определяет класс Program с одним методом Main , который принимает в качестве аргумента массив String.
Main — точка входа в приложение. Это метод, который автоматически вызывается средой выполнения при запуске приложения. Все аргументы, предоставленные в командной строке при запуске приложения, доступны через массив args.
Запуск приложения
Выполните следующие команды в окне терминала:
Программа отображает "Hello World!" и заканчивается.
Улучшение приложения
Давайте расширим приложение. Теперь у пользователя будет запрашиваться имя, которое затем будет отображаться с датой и временем.
Откройте файл Program.cs, щелкнув его.
Когда в Visual Studio Code будет предложено добавить недостающие ресурсы для сборки и отладки приложения, выберите Да.
В Program.cs замените содержимое метода Main (строка, вызывающая Console.WriteLine ) следующим кодом:
Этот код отображает запрос в окне консоли и ожидает, чтобы пользователь ввел строку текста и нажал клавишу ВВОД . Приложение сохраняет полученную строку в переменной с именем name . Оно также получает значение свойства DateTime.Now, которое содержит текущее локальное время, и присваивает его переменной с именем currentDate . Затем оно отображает эти значения в окне консоли. Наконец, приложение выводит запрос в окне консоли и вызывает метод Console.ReadKey(Boolean) для ожидания ввода данных пользователем.
Знак доллара ( $ ) перед строкой позволяет вставить такие выражения, как имена переменных, в фигурные скобки в строке. Значение выражения вставляется в строку вместо выражения. Такой синтаксис называется интерполированными строками.
В Visual Studio Code необходимо явно сохранить изменения. В отличие от Visual Studio, изменения файлов не сохраняются автоматически при сборке и запуске приложения.
Запустите программу еще раз:
В ответ на приглашение в командной строке введите имя и нажмите клавишу ВВОД .
Нажмите любую клавишу для выхода из программы.
Дополнительные ресурсы
Следующие шаги
If you need to start executing commands using Visual Studio Code for your development tasks, you may need to know how to access a terminal.
In this article, we’ll walk you through how to open a Visual Studio Code terminal for coding in a variety of programming languages. Plus, we’ll cover how to find VS code extensions for coding support, and answers to other commonly asked questions.
How to Open Terminal in VS Code?
Visual Studio Code is a powerful lightweight source code editor. As well as including lots of convenient development features, it allows for coding in pretty much any programming language.
Though it comes with built-in support for all programming languages, installing extensions for each language is recommended for access to extra support features like auto-complete and quick fixes.
To access the integrated terminal from the workplace root in VS Code, do the following:
How to Open Python Terminal in VS Code?
To open a VS code integrated terminal from the root of your workplace, for coding in Python:
Note: To install a Python extension; from the VS Code Welcome screen, select “Tools and Languages”. The Extensions Market Place will appear on the left; enter a “Python” search for a list of the appropriate extensions.
- Launch the VS code app then press “Ctrl+`” to open a terminal.
- Press “Command” or “Ctrl” + “Shift” + “p” to access the “Command Palette.”
- A search bar will pop-up, enter a search for “View: Toggle Integrated Terminal command,” and select it. This command toggles between displaying the terminal panel in and out of view.
- In the new terminal window, start entering your Python commands.
How to Open Java Terminal in VS Code?
To open a VS code integrated terminal from the root of your workplace, for coding in Java:
Note: To install a Java extension; from the VS Code Welcome screen, select “Tools and Languages”. The Extensions Market Place will appear on the left; enter a “Java” search for a list of the appropriate extensions.
- Launch the VS code app then press “Ctrl+`” to open a terminal.
- Press “Command” or “Ctrl” + “Shift” + “p” to access the “Command Palette.”
- A search bar will pop-up, enter a search for “View: Toggle Integrated Terminal command,” and select it. This command toggles between displaying the terminal panel in and out of view.
- In the new terminal window, start entering your Java commands.
How to Open JavaScript Terminal in VS Code?
To open a VS code integrated terminal from the root of your workplace, for coding in JavaScript:
Note: To install a JavaScript extension; from the VS Code Welcome screen, select “Tools and Languages”. The Extensions Market Place will appear on the left; enter a “JavaScript” search for a list of the appropriate extensions.
- Launch the VS code app then press “Ctrl+`” to open a terminal.
- Press “Command” or “Ctrl” + “Shift” + “p” to access the “Command Palette.”
- A search bar will pop-up, enter a search for “View: Toggle Integrated Terminal command,” and select it. This command toggles between displaying the terminal panel in and out of view.
- In the new terminal window, start entering your JavaScript commands.
How to Open Ruby Terminal in VS Code?
To open a VS code integrated terminal from the root of your workplace, for coding in Ruby:
Note: To install a Ruby extension; from the VS Code Welcome screen, select “Tools and Languages.” The Extensions Market Place will appear on the left; enter a “Ruby” search for a list of the appropriate extensions.
- Launch the VS code app then press “Ctrl+`” to open a terminal.
- Press “Command” or “Ctrl” + “Shift” + “p” to access the “Command Palette.”
- A search bar will pop-up, enter a search for “View: Toggle Integrated Terminal command,” and select it. This command toggles between displaying the terminal panel in and out of view.
- In the new terminal window, start entering your Ruby commands.
How to Open Node.js Terminal in VS Code?
To open a VS code integrated terminal from the root of your workplace, for coding in Node.js:
Note: To install a Node.js extension; from the VS Code Welcome screen, select “Tools and Languages.” The Extensions Market Place will appear on the left; enter a “Node.js” search for a list of the appropriate extensions.
- Launch the VS code app then press “Ctrl+`” to open a terminal.
- Press “Command” or “Ctrl” + “Shift” + “p” to access the “Command Palette.”
- A search bar will pop-up, enter a search for “View: Toggle Integrated Terminal command,” and select it. This command toggles between displaying the terminal panel in and out of view.
- In the new terminal window, start entering your Node.js commands.
How to Open C/C++ Terminal in VS Code?
To open a VS code integrated terminal from the root of your workplace, for coding in C/C++:
Note: To install a C/C++ extension; from the VS Code Welcome screen, select “Tools and Languages”. The Extensions Market Place will appear on the left; enter a “C/C++” search for a list of the appropriate extensions.
- Launch the VS code app then press “Ctrl+`” to open a terminal.
- Press “Command” or “Ctrl” + “Shift” + “p” to access the “Command Palette.”
- A search bar will pop-up, enter a search for “View: Toggle Integrated Terminal command,” and select it. This command toggles between displaying the terminal panel in and out of view.
- In the new terminal window, start entering your C/C++ commands.
How to Open Go Terminal in VS Code?
To open a VS code integrated terminal from the root of your workplace, for coding in Go:
Note: To install a Go extension; from the VS Code Welcome screen, select “Tools and Languages.” The Extensions Market Place will appear on the left; enter a “Go” search for a list of the appropriate extensions.
- Launch the VS code app then press “Ctrl+`” to open a terminal.
- Press “Command” or “Ctrl” + “Shift” + “p” to access the “Command Palette.”
- A search bar will pop-up, enter a search for “View: Toggle Integrated Terminal command,” and select it. This command toggles between displaying the terminal panel in and out of view.
- In the new terminal window, start entering your Go commands.
What’s the Shortcut to Open Terminal in VS Code?
Use the following shortcut to open a terminal in VS Code:
- “Ctrl” + keyboard shortcut + the backtick character ` (Ctrl+`).
How to Open Terminal in Current Directory in VS Code?
To open a terminal at the current directory in VS Code:
Install an extension like “TerminalHere” to be able to access a terminal at your current file’s directory.
- Launch VS code app, then access the folder you wish to open a terminal from.
- From the menu bar, select “View” > “Command Palette.”
- Search for the “terminalHere.create” command to create the terminal from the current file’s directory.
How to Open Terminal in VS Code in New Window?
To open a VS code terminal in a new window:
How to Open Terminal in VS Code on Mac?
To open a VS code terminal on macOS:
- Launch the VS code app.
- Press “Ctrl+`” to open a terminal.
How to Open Terminal in VS Code on Windows?
Similarly, to opening a VS code terminal on macOS, via Windows its:
- Launch VS code app.
- Press “Ctrl+`” to open a terminal.
How to Open Terminal in VS Code as Administrator?
You would open a terminal in VS code as an Administrator the same way as a non-administrator:
- Launch the VS code app.
- Press “Ctrl+`” to open a terminal.
To run code as an administrator in Windows:
- Right-click on the VS Code app.
- Select “Run this program as an administrator.”
- Or from within a terminal, you can use the platform utility “runas.exe.”
Additional FAQs
How Do I Open a Directory in Terminal VS Code?
To automatically open the current directory in a VS code terminal:
1. Launch the VS code app, then press “Ctrl+`” to open a terminal.
2. From the menu bar, select “View” > “Command Palette.”
3. Start typing “Shell” or “Shell Command” into the search box.
4. Select “Shell Command: install “code: command in PATH.” A successful Shell command “Code” installed in PATH pop-up should appear.
5. To confirm this, if you currently have a running terminal session, quit or restart it.
6. Navigate to the directory of the files you wish to access in VS code then type “code.” (the word “code” followed by a space, then a period). The folder will open in VS code terminal automatically.
How Do I Run Code in Terminal?
To run code in a terminal across macOS, Windows, and Linux:
On Windows:
1. Press the “Windows” key + “r” to access the run program.
2. Then type in “cmd” or “command” and press enter.
3. Enter the commands for the code you wish to run.
On macOS:
1. Navigate to “Finder” > “Utilities,” then “Terminal.app.”
2. Enter the commands for the code you wish to run.
What Is the Extension for Visual Studio?
There is an extensive range of extensions available for Visual Studio, from programming languages and debuggers to formatters and themes. To discover what’s available, navigate to the Extension Market Place in VS code.
From the VS Code Welcome screen, select “Tools and Languages.” The Extension Market Place will appear on the left-hand side of the screen.
How Do I Install an Extension for VS?
For the easiest way to find and install a VS code extension for various programming languages:
1. Launch the VS code app and the welcome screen will be displayed.
2. Select “Menu” > “View” > “Extensions” to access the Extensions Market Place.
3. Enter “@categories “programming language” to see a list of all programming languages.
4. Click on one for access to its details and the link for installation.
How to Get Terminal?
To access a terminal using Windows:
1. Press the “Windows” key + “r” to access the run program.
2. Then type in “cmd” or “command” and press enter.
1. Navigate to “Finder” > “Utilities,” then “Terminal.app.”
Accessing Integrated Terminals in VS Code
What makes the VS Code source-editor so powerful is its ability to support almost all of the major programming languages. In just a couple of clicks, you can open an integrated terminal window to enter commands in pretty much any language of your choice.
Now that you know how straightforward it is to access a terminal in VS Code, what programming language did you use? Did you find the assistance useful or not? We want to hear about your experience using VS Code terminals; let us know in the comments section below.
Читайте также: