You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ide/reference/command-prompt-powershell.md
+35-39Lines changed: 35 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
---
2
-
title: 'Command-line shells & prompt for developers'
3
-
description: Start from the Tools > Command Line menu. Select the Visual StudioDeveloper Command Prompt, Developer PowerShell, or terminal to use .NET and C++ tools more easily.
2
+
title: Command-Line Shells & Prompt For Developers
3
+
description: Learn about the two command-line shells for developers in Visual Studio, the Developer Command Promptand the Developer PowerShell.
4
4
author: Mikejo5000
5
5
ms.author: mikejo
6
-
ms.date: 08/23/2024
6
+
ms.date: 08/06/2025
7
7
ms.topic: conceptual
8
8
helpviewer_keywords:
9
9
- "Visual Studio command prompt"
@@ -19,23 +19,23 @@ ms.subservice: general-ide
19
19
20
20
Visual Studio includes two command-line shells for developers, a command prompt and an instance of PowerShell, as follows:
21
21
22
-
-**Visual Studio Developer Command Prompt** - A standard command prompt with certain environment variables set to make using command-line developer tools easier.
22
+
-**Visual Studio Developer Command Prompt**: A standard command prompt with certain environment variables set to make using command-line developer tools easier.
23
23
24
24
::: moniker range="vs-2019"
25
-
:::image type="content" source="media/developer-command-prompt-for-vs/command-prompt.png" alt-text="Screenshot of the Developer Command Prompt for Visual Studio 2019 showing clrver tool.":::
25
+
:::image type="content" source="media/developer-command-prompt-for-vs/command-prompt.png" alt-text="Screenshot of the Developer Command Prompt for Visual Studio 2019.":::
26
26
::: moniker-end
27
27
28
28
::: moniker range=">=vs-2022"
29
-
:::image type="content" source="media/developer-command-prompt-for-vs/developer-command-prompt-visual-studio-2022.png" alt-text="Screenshot of the Developer Command Prompt for Visual Studio that shows the clrver tool.":::
29
+
:::image type="content" source="media/developer-command-prompt-for-vs/developer-command-prompt-visual-studio-2022.png" alt-text="Screenshot of the Developer Command Prompt for Visual Studio.":::
30
30
::: moniker-end
31
31
32
-
-**Visual Studio Developer PowerShell** - More powerful than a command prompt. For example, you can pass the output of one command (known as a *cmdlet*) to another cmdlet. This shell has the same environment variables set as Developer Command Prompt. Available since Visual Studio 2019.
32
+
-**Visual Studio Developer PowerShell**: More powerful than a command prompt. For example, you can pass the output of one command, known as a *cmdlet*, to another cmdlet. This shell has the same environment variables set as Developer Command Prompt. Available since Visual Studio 2019.
33
33
34
34
::: moniker range=">=vs-2022"
35
35
:::image type="content" source="media/developer-command-prompt-for-vs/developer-powershell-visual-studio-2022.png" alt-text="Screenshot of the Developer PowerShell tool in Visual Studio 2022 and later.":::
36
36
::: moniker-end
37
37
38
-
Starting in [Visual Studio 2019](https://devblogs.microsoft.com/visualstudio/say-hello-to-the-new-visual-studio-terminal/), Visual Studio includes an integrated **terminal**that can host either of these shells (Developer Command Prompt and Developer PowerShell). You can also open multiple tabs of each shell. The Visual Studio terminal is built on top of [Windows Terminal](/windows/terminal/). To open the terminal in Visual Studio, select **View** > **Terminal**.
38
+
Starting in Visual Studio 2019, Visual Studio includes an [integrated terminal](https://devblogs.microsoft.com/visualstudio/say-hello-to-the-new-visual-studio-terminal/)that can host either of these command-line shells. You can also open multiple tabs of each shell. The Visual Studio terminal is built on top of [Windows Terminal](/windows/terminal/). To open the terminal in Visual Studio, select **View** > **Terminal**.
39
39
40
40
::: moniker range=">=vs-2022"
41
41
:::image type="content" source="media/developer-command-prompt-for-vs/visual-studio-2022-terminal-window.png" alt-text="Screenshot of the Visual Studio terminal pane that shows multiple tabs.":::
@@ -50,7 +50,7 @@ Starting in [Visual Studio 2019](https://devblogs.microsoft.com/visualstudio/say
50
50
51
51
When you open one of the developer shells from Visual Studio, either as a separate app or in the Terminal window, it opens to the directory of your current solution (if you have a solution loaded). This behavior makes it convenient to run commands against the solution or its projects.
52
52
53
-
Both shells have specific environment variables set that enable you to use command-line developer tools more easily. After opening one of these shells, you can enter the commands for different utilities without having to know where they're located.
53
+
Both shells have specific environment variables that enable you to use command-line developer tools more easily. After opening one of these shells, you can enter the commands for different utilities without having to know where they're located.
54
54
55
55
|Popular commands|Description|
56
56
|--|--|
@@ -73,52 +73,44 @@ Follow these steps to open Developer Command Prompt or Developer PowerShell from
73
73
1. On the menu bar, select **Tools** > **Command Line** > **Developer Command Prompt** or **Developer PowerShell**.
74
74
75
75
::: moniker range=">=vs-2022"
76
-
:::image type="content" source="media/developer-command-prompt-for-vs/visual-studio-2022-command-line-menu.png" alt-text="Screenshot of the Command Line menu in Visual Studio 2022 and later.":::
76
+
:::image type="content" source="media/developer-command-prompt-for-vs/visual-studio-2022-command-line-menu.png" alt-text="Screenshot of the Command Line menu in Visual Studio.":::
77
77
::: moniker-end
78
78
79
79
::: moniker range="vs-2019"
80
-

81
-
::: moniker-end
82
-
80
+
:::image type="content" source="media/developer-command-prompt-for-vs/vs-menu.png" alt-text="Screenshot of the Command Line menu in Visual Studio 2019.":::
81
+
::: moniker-end
82
+
83
83
## Start from Windows menu
84
84
85
-
Another way to start the shells is from the Start menu. You may have multiple command prompts, depending on the version of Visual Studio and any additional SDKs and workloads you've installed.
85
+
Another way to start the shells is from the Start menu. You could have multiple command prompts, depending on the version of Visual Studio and any other SDKs and workloads you've installed.
86
86
87
87
### Windows 11
88
88
89
-
1. Select **Start** :::image type="content" source="media/developer-command-prompt-for-vs/windows-11-logo-button.png" alt-text="Screenshot of the Start button in Windows 11.":::, and then in the **Type here to search** dialog box, enter either `developer command prompt` or `developer powershell`.
89
+
1. Select **Start**, and then in the **Type here to search** dialog box, enter either `developer command prompt` or `developer powershell`.
90
90
91
91
1. Select the App result that's associated with your search text.
92
92
93
93
### Windows 10
94
94
95
-
1. Select **Start**, and then scroll to the letter **V**.
95
+
1. Select **Start**, and then scroll to the letter **V**.
96
96
97
97
1. Expand the **Visual Studio 2019** or **Visual Studio 2022** folder.
98
98
99
99
1. If you're running Visual Studio 2019, select either **Developer Command Prompt for VS 2019** or **Developer PowerShell for VS 2019**. If you're running Visual Studio 2022, select either **Developer Command Prompt for VS 2022** or **Developer PowerShell for VS 2022**.
100
100
101
101
Alternatively, you can start typing the name of the shell in the search box on the taskbar, and select the result you want as the result list starts to display the search matches.
102
102
103
-

104
-
105
-
### Windows 8.1
106
-
107
-
1. Go to the **Start** screen, by pressing the Windows logo key  on your keyboard for example.
108
-
109
-
1. On the **Start** screen, press **Ctrl**+**Tab** to open the **Apps** list, and then press **V**. This brings up a list that includes all installed Visual Studio command prompts.
110
-
111
-
1. If you're running Visual Studio 2019, select either **Developer Command Prompt for VS 2019** or **Developer PowerShell for VS 2019**. If you're running Visual Studio 2022, select **Developer Command Prompt for VS 2022** or **Developer PowerShell for VS 2022**.
103
+
:::image type="content" source="media/developer-command-prompt-for-vs/windows-10-search.gif" alt-text="Animation that shows the search behavior in Windows 10.":::
112
104
113
105
## Start from file browser
114
106
115
-
Usually, the shortcuts for the shells you have installed are placed in the **Start Menu** folder for Visual Studio, such as in *%ProgramData%\Microsoft\Windows\Start Menu\Programs\Visual Studio 2019\Visual Studio Tools*. But if searching for the command prompt doesn't produce the expected results, you can try to manually locate the files on your machine.
107
+
Usually, the shortcuts for the shells you installed are placed in the **Start Menu** folder for Visual Studio, such as in *%ProgramData%\Microsoft\Windows\Start Menu\Programs\Visual Studio 2019\Visual Studio Tools*. But if searching for the command prompt doesn't produce the expected results, you can try to manually locate the files on your machine.
116
108
117
109
### Developer Command Prompt
118
110
119
111
Search for the name of the command prompt file, which is *VsDevCmd.bat*, or go to the Tools folder for Visual Studio, such as *%ProgramFiles%\Microsoft Visual Studio\2022\Community\Common7\Tools* (the path changes according to your Visual Studio version, edition, and installation location).
120
112
121
-
Once you've located the command prompt file, open it by entering the following command in a regular command prompt window:
113
+
After you locate the command prompt file, open it by entering the following command in a regular command prompt window:
122
114
123
115
::: moniker range="vs-2022"
124
116
@@ -148,21 +140,22 @@ Or enter the following command in the Windows **Run** dialog box:
148
140
149
141
::: moniker-end
150
142
151
-
Since Visual Studio 2015, the Developer Command Prompt sets the `VSCMD_VER` environment variable which contains the version information for Visual Studio (ex: `17.9.0`). If you need to detect whether the Developer Command Prompt has already been run in your console, it is recommended to check whether `VSCMD_VER` has been defined or not.
143
+
Since Visual Studio 2015, the Developer Command Prompt sets the `VSCMD_VER` environment variable, which contains the version information for Visual Studio (for example: 17.14.8). If you need to detect whether the Developer Command Prompt was already run in your console, it's recommended to check whether `VSCMD_VER` has been defined or not.
152
144
153
145
> [!TIP]
154
146
> Make sure to edit the path to match the version or edition of Visual Studio that you're using.
155
147
156
148
### Developer PowerShell
157
149
158
-
Search for a PowerShell script file named *Launch-VsDevShell.ps1*, or go to the Tools folder for Visual Studio, such as *%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\Common7\Tools*. (The path changes according to your Visual Studio version, edition, and installation location.) Once you've located the PowerShell file, run it by entering the following command at a Windows PowerShell or PowerShell 6 prompt.
150
+
Search for a PowerShell script file named *Launch-VsDevShell.ps1*, or go to the Tools folder for Visual Studio, such as *%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\Common7\Tools*. The path changes according to your Visual Studio version, edition, and installation location. After you locate the PowerShell file, run it by entering the following command at a Windows PowerShell or PowerShell 6 prompt.
@@ -176,18 +169,18 @@ By default, the Developer PowerShell that launches is configured for the Visual
176
169
> [!TIP]
177
170
> The [execution policy](/powershell/module/microsoft.powershell.core/about/about_execution_policies) must be set in order for the cmdlet to run.
178
171
179
-
The `Launch-VsDevShell.ps1` script works by locating the `Microsoft.VisualStudio.DevShell.dll` PowerShell module in the Visual Studio installation path, loading it, and then invoking the `Enter-VsDevShell` cmdlet. Installed shortcuts, like those in the Start menu, load the module and invoke the cmdlet directly. `Launch-VsDevShell.ps1` is the recommended way to initialize Developer PowerShell interactively or for scripting build automation.
172
+
The *Launch-VsDevShell.ps1* script works by locating the *Microsoft.VisualStudio.DevShell.dll* PowerShell module in the Visual Studio installation path, loading it, and then invoking the `Enter-VsDevShell` cmdlet. Installed shortcuts, like those in the Start menu, load the module and invoke the cmdlet directly. *Launch-VsDevShell.ps1* is the recommended way to initialize Developer PowerShell interactively or for scripting build automation.
180
173
181
174
## Command-line arguments
182
175
183
-
You can use command-line arguments for either of the shells, Developer Command Prompt or Developer PowerShell.
176
+
You can use command-line arguments for either of the shells: Developer Command Prompt or Developer PowerShell.
184
177
185
178
### Target Architecture and Host Architecture
186
179
187
-
For build tools -- like the C++ compiler -- that create outputs targeting specific CPU architectures, the developer shells can be configured using the appropriate command-line argument. The architecture of the build tool binaries can also be configured by using command-line arguments. This is useful when the build machine is a different architecture than the target architecture.
180
+
For build tools, like the C++ compiler, that create outputs targeting specific CPU architectures, the developer shells can be configured using the appropriate command-line argument. The architecture of the build tool binaries can also be configured by using command-line arguments. This is useful when the build machine is a different architecture than the target architecture.
188
181
189
182
> [!TIP]
190
-
> Beginning with Visual Studio 2022, `msbuild`will default to a 64-bit msbuild.exe binary, regardless of the Host Architecture.
183
+
> Beginning with Visual Studio 2022, `msbuild`defaults to a 64-bit *msbuild.exe* binary, regardless of the Host Architecture.
191
184
192
185
|Shell|Argument|
193
186
|--|--|
@@ -197,7 +190,7 @@ For build tools -- like the C++ compiler -- that create outputs targeting specif
> Developer PowerShell arguments -Arch and -HostArch are only available beginning with [Visual Studio 2022 version 17.1](/visualstudio/releases/2022/release-notes#1710--visual-studio-2022-version-171-newreleasebutton).
193
+
> Developer PowerShell arguments `-Arch` and `-HostArch` are only available beginning with [Visual Studio 2022 version 17.1](/visualstudio/releases/2022/release-notes#1710--visual-studio-2022-version-171-newreleasebutton).
201
194
202
195
The following table lists which architectures are supported, and whether they can be used for Target Architecture or Host Architecture arguments.
203
196
@@ -213,17 +206,20 @@ The following table lists which architectures are supported, and whether they ca
213
206
214
207
#### Examples
215
208
216
-
Start the Developer Command Prompt for Visual Studio 2019 Community Edition on a 64-bit machine, creating build outputs that target 64-bit:
209
+
Start the Developer Command Prompt for Visual Studio 2019 Community Edition on a 64-bit machine, creating build outputs that target *64-bit*:
Start the Developer PowerShell for the Community Edition of [Visual Studio 2022 version 17.1](/visualstudio/releases/2022/release-notes#1710--visual-studio-2022-version-171-newreleasebutton) or later on a 64-bit machine, creating build outputs that target arm64:
221
+
Start the Developer PowerShell for the Community Edition of [Visual Studio 2022 version 17.1](/visualstudio/releases/2022/release-notes#1710--visual-studio-2022-version-171-newreleasebutton) or later on a 64-bit machine, creating build outputs that target *ARM64*:
0 commit comments